performance - PHP file uploads. POST vs PUT?

268

I am building a website where people can upload video with the file size restriction of 1GB. Firefox>3.6 and Chrome>11 are the only browsers i intend to support. Is there any advantage/disadvantage of file uploads using PUT method over POST method for huge files. How does different http methods affect the performance of the website?

684

Answer

Solution:

I have no personal opinion on this matter but here are some resources that may help you:

PUT is a much more limited operation that never does anything more than PUT one page at a specified URL. It is idempotent, which is a fancy way of saying that doing it twice is the same as doing it once. Both PUT and POST can be used to create new pages. However PUT should be used when the client specifies the location for the page. PUT is normally the right protocol for a web editor like DreamWeaver or BBEdit. POST is used when the client gives sends the page to the the server, and the server then tells the client where it put it. POST is normally the right protocol for a blog editor like TypePad or anything that inputs into a content management system. In SQL analogy, POST is an INSERT with an automatically generated primary key, and PUT is an INSERT that specifies the primary key in the INSERT statement.


From my understanding of reading the above links, skimming over the mains sections tells me that PUT methods are mainly used for raw data with no organization to the content, there not encoded or split into multi part messages.

PUT seems like Socket to Socket connection such as Telnet <> Mail Server, so using POST may provide more of an underlying framework to uploading multiple files in a single batch, as you already have the boundaries built in my the POST method

People are also looking for solutions to the problem: linux - Need a simple web server to test out PHP, DJango on localhost

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.