Hello,
I was wondering what's the best way to prevent duplicate uploads - in other words, if user attempts to upload a file that is already present on the server, I want to display a nice message to the user saying that the file's already been uploaded (potentially by someone else). The main idea is to avoid wasting bandwidth.
An obvious way to do this is to calculate the checksum of the file that the user attempts to upload, so that I can see if a file with such checksum is already present on the server. But is there any way to calculate such checksum on the client side? I realize that Mozilla has some XPCOM API to access files on the browser's file system, but I'd rather go with pure SWFUpload/Flash route as using XPCOM requires the user to grant some extra privileges to the browser.
Many thanks,
Tomasz
Flash (in the browser) does
Flash (in the browser) does not grant access to the user's file system. You don't have any more access to the file than what SWFUpload is exposing. The best SWFUpload can give you is the File name, size, creation date, etc.
You should use this information and an AJAX routine to check the file against those on the server. Do this check in the uploadStart event and return false if you don't want the file to be uploaded.
Currently there is no way to prevent the file from being queued.