Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I always wondered what would happen if I'm uploading a php file via FTP and visitor requests it at exact same moment?

I'm thinking if php file is half uploaded he will receive error, and on refresh if file was uploaded he will see it working 100%. Or maybe FTP works in a different way so file is not being replaced untill it has been uploaded completely. Can you please shed light on this part of the protocol and how it is handled?


share|improve this question
Similar Q/A about PHP Code Execution while uploading PHP via FTP is discussed here & here. – Mayura Oct 5 '12 at 14:24

All that you described are options based upon how exactly the ftp server "uploads" the file.

If the file is uploaded to a temp directory and the moved into place when the upload is finished, then the file would just go from a 404 to existing.

However, most ftp servers just upload the file in place. What this means is that if someone requests the file while it's uploading (say, a large video file), the webserver will start sending them the file. If it hits the end of the file before it's finished uploading, then the user will get an incomplete file. If the file finishes uploading before the user reaches the end, then they'll get the whole file.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.