WebFileUploader: Check MIME type before upload

Is there a way to check the MIME type on client side before upload a file with WebFileUploader?, or, Can I filter the possible MIME types on the system dialog to choose the file to be uploaded?

The best you can do is look at the file extension, if there is one, in the FileAdded event. Sucks, to be sure.

Thanks @Bob Keeney , for now I’ll have to settle. When I have a little more time I’ll try it with Javascript.

You might want to check out WebCustomControls at http://webcustomcontrols.com/?page_id=70 they have a FileUploader too that has some different features. Dunno if it will help you or not but it’s worth taking a look at it.

Someone should file a feature request about this. :slight_smile:

Technically, there was one already: <https://xojo.com/issue/14947> But it was marked as implemented with this comment “This feature has been implemented to the greatest extent possible. It is not possible for us to add all the features requested, such as determining the file size, but we have implemented everything we can.”

Perhaps we could reopen it?

Thanks for the mention!

The jQueryFileUpload control in WCC does provide the MIME type when a file is added to the control (before the upload starts). I don’t know how easy/difficult it would be for a client to spoof this. The docs for this control discuss security issues such as this and I stress that you want to double check files uploaded to the server before doing anything with them. But aside from intentional attempts at spoofing, the MIME type should be accurate on all modern browsers. (Just double checked it on IE which is the weakest in terms of supporting jQueryFileUpload features and the MIME type works.)

And yes…I am still alive :slight_smile: 1.3.3 does work on the latest version of Xojo. 2.0 is still coming, and everyone will get that update after which the normal “1 year free updates” rule will apply.

[quote=171021:@Bob Keeney]Technically, there was one already: <https://xojo.com/issue/14947> But it was marked as implemented with this comment “This feature has been implemented to the greatest extent possible. It is not possible for us to add all the features requested, such as determining the file size, but we have implemented everything we can.”

Perhaps we could reopen it?[/quote]
Yeah, that was before my time. :stuck_out_tongue:

I’d prefer that a new case be created because reopening things that were previously implemented makes reviewing case history a bit confusing.

Done. <https://xojo.com/issue/38386>