View Full Version : How can I check to see if a file being uploaded already exists?

08-20-2005, 06:51 PM
I want to avoid duplicate files so how can I check to make sure the filename of the uploading file doesn't already exist?

I want to do something like...

if UploadRequest.Item(AF_curKey).Item("FileName") <> some_file then

Anyone got ideas?

08-21-2005, 12:09 AM
i dont know what you are using but generally uploaders will only be able to read the filename once the file is uploaded, you can then just not bother saving it once it exists. im not too sure though. it will require FSO and the file name you are uploading i expect

08-22-2005, 03:55 AM
Don't know if this might hopefully help at all.

To see if a file exists:

Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(MyFilenameVar) Then...