PDA

View Full Version : Fileupload File Types



dreamcaster
11 Oct 2009, 11:08 PM
Hello experts,

In the ExtJS example in fileupload, how can I force the file upload field to choose only specific file types? e.g. .jpg or .doc only?

Thanks

dreamcaster
9 Nov 2009, 11:11 PM
Anyone?

Bruce wang
9 Nov 2009, 11:15 PM
i have the same problem ,maybe it can't implement .

aw1zard2
11 Nov 2009, 6:56 AM
inside the Ext.onReady using the file example try this.

fbutton.fileInput.dom.accept = "text/html,text/plain";

Setting the accept property to the content type you need.
It is comma separated.

Let me know if this helps.

I looked in firebug while viewing the sample putting a break before the formpanel loaded from the Ext.onReady.

:)

dreamcaster
11 Nov 2009, 8:03 PM
Hi, thanks for the reply, Tried your solution but I got no luck. :(

aw1zard2
12 Nov 2009, 6:56 AM
Yeah sorry should have clarified it works in Opera fine but not the other browsers. And Opera still gives All files so kinda point less.

For IE you can force the dom to use it by using the DOM.prototype.

But the other browsers just need to get this working lol.

It's been in the w3c for too long to not be supported.

:)

aw1zard2
25 Nov 2009, 8:15 AM
I found that using swfupload for file uploads allows you to change the file type you want to see using the file dialog by using flash to control it.

http://www.extjs.com/forum/showthread.php?t=82569

The link above is a nice file upload queue that uses swfupload in which you can tell it what file types.

File types are assigned like so:

"*.jpg;*.gif;*.png"

Separated by a semicolon.

Hope this helps :)

dreamcaster
25 Nov 2009, 7:10 PM
@aw1zard2

Thanks. Really cool.