This is nice, but it's really just using a regexp or pattern to define file
extensions... Not detecting mime type within the browser client on upload.
People could just rename the file extension of the file that they are
uploading, and the validator would fail. I'm pretty sure that javascript
won't return mime types to you. The only way that I know to validate mime
types on a file upload is on the server side, and by then... The file is
already uploaded. You can, however use the 'accept=' attribute of the input
type="file" ... And refuse to allow upload of a comma delimited list of mime
types:

<input type="file" name="myFile" accept="text/html,image/jpeg,audio/mpeg">

I'm pretty sure that this occurs in the browser prior to upload.

Jim Rising
Sr. Cold Fusion Developer
ICGLink Inc.
www.icglink.com


-----Original Message-----
From: Massimo Foti [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 11, 2007 9:42 AM
To: CF-Talk
Subject: Re: Spry - File Upload - validate mime type

> Any one of a way to validate the mime type of a file before it's 
> uploaded using Ajax or Spry?

If you need to validate images this could work (fails silently on FF, see
the notes):
http://www.massimocorner.com/validator/samples/image_upload.htm

----------------------------
Massimo Foti, web-programmer for hire
Tools for ColdFusion and Dreamweaver developers:
http://www.massimocorner.com
----------------------------




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Macromedia ColdFusion MX7
Upgrade to MX7 & experience time-saving features, more productivity.
http://www.adobe.com/products/coldfusion?sdid=RVJW

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:283453
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to