Results 1 to 4 of 4

Thread: fileupload?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Posts
    183

    fileupload?

    I am using the fileupload text box to get a file name to upload to my server (you know the browse button and the textbox that displays the file path). Was wondering if there is a way to set the types of files that it can find. By default it searches for * all files. I want it to just find textfiles, any ideas?

  2. #2
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    I don't know if there's a parameter for it in HTML, but whatever you're using for the upload (CGI, PHP?) you could check in there and then report it if it's an error.

    And you can always cheat the file dialog, even if it says only text files. So you'd need that anyways.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  3. #3
    Fanatic Member punkpie_uk's Avatar
    Join Date
    Sep 2001
    Location
    UK
    Posts
    645
    the accept attribute is supposed to let you pass a valid MIME type, but I've never been too successful with it to be honest.

    Code:
    <INPUT TYPE="file" NAME="html_file" ACCEPT="text/html">
    SPREAD THE WORD!!! Are You Lee McCormick? Because I Am



    Lee M McCormick
    [email protected]

    Lee McCormick.com - Live
    Dynamically Webbed.com - In development but live

  4. #4
    Frenzied Member Rick Bull's Avatar
    Join Date
    Apr 2002
    Location
    England
    Posts
    1,444
    Yeah I don't think any browser supports it yet. I would probably add a javascript to the onsubmit event of the form that checks (using a regexpr) if the extension is right, and return false if it's not. Then do what the Hobo says a check at the server in case the user has JS disabled.

Posting Permissions

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



Click Here to Expand Forum to Full Width