Upload Form

Discussion in 'PHP' started by cavendano, Jun 17, 2009.

  1. #1
    Ok heres my problem...
    I have an upload form that works great...the only problem is that my site will only allow certain file types to be uploaded..
    the uploader script is html with a php backend..
    how can I set it so that when user hits "Browse" button only the file extensions that I have set will show up in their explorer bar instead of all files.
     
    cavendano, Jun 17, 2009 IP
  2. Weirfire

    Weirfire Language Translation Company

    Messages:
    6,979
    Likes Received:
    365
    Best Answers:
    0
    Trophy Points:
    280
    #2
    I'm not entirely sure this is possible. It would probably have to make use of a script written for the client side which they would have to download before uploading anything.

    It's much easier to program into your page error reporting and requesting that the user only uploads files which match your criteria. It's dead easy to pull apart the tags from the filename before attempting to upload the file in which case you can tell the user that you don't accept "that file type" which was stated in your preset requirements next to the file uploader.

    Hope this helps.
     
    Weirfire, Jun 17, 2009 IP
  3. ven

    ven Member

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #3
    Check this:
    w3schools.com/TAGS/att_form_accept.asp

    as it says, this feature is not supported by major browsers.

    Other solutions:
    swfupload.org/

    or

    sourceforge.net/projects/jupload/

    Cheers!
     
    ven, Jun 17, 2009 IP
  4. Weirfire

    Weirfire Language Translation Company

    Messages:
    6,979
    Likes Received:
    365
    Best Answers:
    0
    Trophy Points:
    280
    #4
    Very nice solution ven. I hadn't heard of that accept function. Those browsers cover 99.2% of the visitors to your site. You could simply put in a clause whereby if they are not using those browsers they can't upload any files... problem solved.

    Of course if you have 100,000 unique visitors a day you are excluding 800 people a day from being able to use your site. lol
     
    Weirfire, Jun 17, 2009 IP
  5. cavendano

    cavendano Well-Known Member

    Messages:
    360
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    130
    #5
    looks like flash is one of the ways to do it...
    thanks for the info!
     
    cavendano, Jun 17, 2009 IP