Re: Checking file names when uploading

  •  06-05-2005, 2:08 PM

    Re: Checking file names when uploading

    Adam,

    Thanks for the mods. I have tested them and found a couple of problems:

    1. In FilePost.asp, the new function ValidFileName only allows extensions gif, jpg, jpeg and png. This conflicts with the function ValidFileExtension which allows many more. Also, ValidFileName is used both for file type "document" and "image".

    2. The ValidFileName function doesn't allow the hyphen character, which is often used in file names. The "\w" character class only allows alpha characters, numbers and underscore.

    So to fix both the above, I changed the regexp pattern to: "^[a-zA-Z0-9\._-]+$"

    What I would really like, is to automatically replace spaces with underscores when uploading. This would save the user a lot of time. Could you possibly modify the upload to do that?

    One other thing, what were the changes in insert_document.asp ?

    Regards, Torq
View Complete Thread