Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Feb 2005
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question How can I check to see if a file being uploaded already exists?

    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...

    Code:
    if UploadRequest.Item(AF_curKey).Item("FileName") <> some_file then
    Anyone got ideas?

  • #2
    Senior Coder
    Join Date
    Apr 2003
    Location
    England
    Posts
    1,192
    Thanks
    5
    Thanked 13 Times in 13 Posts
    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

  • #3
    Regular Coder
    Join Date
    Aug 2002
    Location
    USA
    Posts
    478
    Thanks
    0
    Thanked 2 Times in 2 Posts
    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...
    J. Paul Schmidt
    www.Bullschmidt.com - Freelance Web and Database Developer
    www.Bullschmidt.com/DevTip.asp - Classic ASP Design Tips


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •