当前位置:网站首页>PUT vs. POST for Uploading Files - RESTful API to be Built Using Zend Framework
PUT vs. POST for Uploading Files - RESTful API to be Built Using Zend Framework
2022-07-03 17:31:00 【Zafo】
problem :
I'm building a RESTful API using Zend Framework via the Zend_Rest_Route. I'm passing Zend_Rest_Route Use Zend Framework Construct a RESTful API.For uploading of files, should I use PUT or POST to handle the process? For uploaded files , I should use PUT still POST To handle the process ?I'm trying to be as consistent as possible with the definition of the REST verbs. I try to be as close as possible to REST The definitions of verbs are consistent .Please refer to: PUT or POST: The REST of the Story . see also : PUT or POST: The rest of the story .
The way I understand this is that I should use PUT if and only if I'm updating the full content of the specified resource. My understanding is that , If and only if I update the entire content of the specified resource , I should use PUT.I'll have to know the exact URL to use PUT. I must know how to use PUT Exact URL.On the other hand, I should use POST if I'm sending a command to the server to create a subordinate of the specified resource, using some server-side algorithm. On the other hand , If I use some server-side algorithms to send commands to the server to create children of a specified resource , I should use POST.
Let's assume this is a REST API for uploading images. Suppose this is a for uploading images REST API.Does that mean I should use POST if the server is to manipulate the image file (ie create thumbnail, resize, etc); Does this mean that if the server wants to manipulate image files ( That is, create thumbnails 、 Resize, etc ), I should use POST Do you ?and use PUT if I just want to save the raw image file to the server? If I just want to save the original image file to the server , Please use PUT?
If I use PUT to handle a file upload, should the process be as follows: If I use PUT To handle file uploads , The process should be as follows :
- The user sends a GET request to retrieve the specific URL to upload the file by PUT. The user sends GET Request to retrieve a specific URL In order to pass the PUT Upload files .
- Then the user sends a PUT request to that URL. Then the user sends the URL send out PUT request .
The file being uploaded is raw - exactly the one the user uploaded. The uploaded file is the original file - It is the file uploaded by the user .
I'm quite new to this stuff; I am very strange to this thing ;so hopefully I'm making sense here... So I hope I'm meaningful here ......
If you know the "best" way to do this, feel free to comment as well. If you know the “ The best ” Method , Please feel free to comment .
Solution :
Reference resources : https://stackoom.com/en/question/QK2S边栏推荐
- Introduction to SolidWorks gear design software tool geartrax
- Online assignment 3 of mobile Internet technology in the 20th autumn of electronic technology [standard answer]
- The difference between get and post
- Apache服务挂起Asynchronous AcceptEx failed.
- STM32H7 HAL库SPI DMA发送一直处于busy的解决办法
- SQL injection database operation foundation
- SVN完全备份svnadmin hotcopy
- 数仓任务里面 跑SQL任务的时候用的数据库账号是在哪里配置的
- Automata and automatic line of non-standard design
- One brush 149 force deduction hot question-10 regular expression matching (H)
猜你喜欢
1164 Good in C
One brush 145 force deduction hot question-2 sum of two numbers (m)
[combinatorics] recursive equation (summary of the solution process of recursive equation | homogeneous | double root | non-homogeneous | characteristic root is 1 | exponential form | the bottom is th
Design e-commerce spike
Notes on problems -- watching videos on edge will make the screen green
1146_ SiCp learning notes_ exponentiation
互聯網醫院HIS管理平臺源碼,在線問診,預約掛號 智慧醫院小程序源碼
Collection of the most beautiful graduation photos in the graduation season, collection of excellent graduation photos
[RT thread] NXP rt10xx device driver framework -- pin construction and use
How to train mask r-cnn model with your own data
随机推荐
一位普通程序员一天工作清单
Assignment examination questions of advanced English (III) for the course examination of Fujian Normal University in February 2022
QT学习日记9——对话框
自动渗透测试工具核心功能简述
Leetcode13. Roman numeral to integer (three solutions)
Apache service suspended asynchronous acceptex failed
绝对定位时元素水平垂直居中
Golang单元测试、Mock测试以及基准测试
免费数据 | 新库上线 | CnOpenData中国保险中介机构网点全集数据
What is the difference between cloud server and cloud virtual machine
ArrayList分析3 : 删除元素
[combinatorics] recursive equation (example of solving recursive equation without multiple roots | complete process of solving recursive equation without multiple roots)
STM32实现74HC595控制
Is AI too slow to design pictures and draw illustrations? 3 sets of practical brushes to save you
[combinatorics] recursive equation (general solution structure of recursive equation with multiple roots | linear independent solution | general solution with multiple roots | solution example of recu
One brush 147-force deduction hot question-4 find the median of two positive arrays (H)
远程办公工具分享|社区征文
STM32H7 HAL库SPI DMA发送一直处于busy的解决办法
Stm32h7 Hal library SPI DMA transmission has been in busy solution
Analyse ArrayList 3: suppression d'éléments