remove file from web server while downloading it
What's happen when FTP user delete some file at the same time some one downloading it? my server language is PHP. tha开发者_如何学Gonks
On a Windows server, you can't remove a file while it's in use by another process.
On Unix systems, the file will be removed, but only for any "new" processes attempting to access it. Anything that already had the file open will be able to read/write from it as they were before. The file will still take up disk space, until such time as ALL file handles on it are closed, at which point it'll truly be deleted. So your FTP user will still be able to finish downloading it.
If your intent is to force the FTP transfer to abort, you should kill the FTP process, which would close its open file handles, allowing the OS to finish deleting the file.
The parts of the file buffered in the Web Server (memory) keep getting downloaded. If that's not enough for the downloader, It errors.
Might depend on the OS. You can't delete a file that's locked for reading purposes. Apache puts a read lock on files while reading them afaik, but I don't really know if it releases the lock before the upload is done. You might want to check this out - I know it's for DBs but it is quite similar to file locking. Also you might want to check this - Apache lock file directive section.
Well as FTP is probably most used, it isn't the safest. When downloading/uploading if your program is interupted or not getting enough speed, yes it could cause files to get deleted always keep a backup.
精彩评论