views:

25

answers:

1

Let's say a user is starting to upload a file to the server via FileReference. What happens to that temporary file if the user cancels the upload or closes the browser? At what point is the server script called? Is the server script (in my case, ColdFusion) called only once the file has been successfully put on the server?

I'm trying to determine if I need to remove any temporary files or if FileReference is smart enough not to execute my server-side script before the file is done uploading to the server.

A: 

The serverside script is called as soon as the user clicks on the upload button. From then on, your serverside script communicates to the server's file system through the webserver (apache,...). Usually, until the transfer is finished, the transfered data is buffered into a temporary file stored in a specifically dedicated folder. When the transfer is finished (as indicated by the http data sent by the user's browser), the file is accessible to your serverside script for further processing. If the transfer is interrupted, the server has a kind of garbage collection process that eliminates uncompleted files to keep the system clean and lean.

This is a general description of the upload process : it will vary according to the specific technologies of the hosting system.

pixeline
Nice. I was just looking at this question 5 minutes ago wondering "how is it possible that no one has been able to give me an answer?" ... so thanks a lot, pixeline.Now, I'm assuming that this garbage collection isn't an auto function for every server... is this something that I should be implementing? The server-side language I'm primarily using is CF8.
dcolumbus
I would assume it to be included in any decent web server. The best is to verify for yourself: find out which is your server's temporary folder, try an upload, interrupt it, and list its content five minutes later: if a temp file is still in, then you got your answer :)
pixeline