|
-
Oct 3rd, 2002, 08:40 PM
#1
Thread Starter
Addicted Member
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?
-
Oct 3rd, 2002, 09:43 PM
#2
Stuck in the 80s
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.
-
Oct 4th, 2002, 03:06 AM
#3
Fanatic Member
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">
-
Oct 4th, 2002, 04:08 AM
#4
Frenzied Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|