FileZilla uploads are not atomic

I've been using FileZilla for a while now for FTP stuff, and while it works great almost all of the time, there is one major flaw I've found:

If I upload a changed file, and a user of my site happens to do something that uses that file (much more common with include files) right at the moment it's uploading, the user gets a PHP error along the lines of unexpected $end because the file is being read while it is half-uploaded.

Is there an option somewhere in FileZilla to lock a file while it is being uploaded, thus making the upload atomic, or am I out of luck and back to the search for a good FTP program?


That's a general problem. FTP protocol does not support any standard file locking mechanism.

It's possible to workaround that by uploading a file to a temporary file name; and rename it to a final name once the upload is done only.

In case the SFTP protocol is an option for you, WinSCP SFTP/FTP client can do this transparently for any upload. Unfortunately, it supports that with the SFTP protocol only, not with the FTP. See Automatic Resume / Transfer to Temporary Filename in WinSCP documentation. (I'm the author of WinSCP)

The FTP server may also support this. For example ProFTPD has HiddenStores directive for this purpose.