PDA

View Full Version : download a file



chinnib37
24 Jan 2013, 3:34 AM
Hi,
I am new to Extjs. I want to download a file from client side. Can anybody help me.

scottmartin
24 Jan 2013, 10:29 AM
It is by design that you cannot access local files from a client. This is for security. It should be handled at the server.

That said, there ActiveX for IE and HTML5 solutions around:
http://www.html5rocks.com/en/tutorials/file/filesystem/

Scott.

chinnib37
24 Jan 2013, 11:59 PM
Thanks Scott.

But my file is on server and I have to download it on client machine on clicking a button. The file can of any type. i.e.,(.xls, .pdf, .png, .txt)

scottmartin
25 Jan 2013, 5:19 AM
Simply specify the document.location and the browser will take over from there.
or: window.open('filename.pdf');

Also, there is also a download component someone created:
http://quispiam.com/download-a-file-via-an-event-for-extjs4/

Scott.