Hi Jhonny...
you'll find out that the entire qooxdoo mailing-list is quite supportive so don't get too much hooked upon me ;-)
Refering to your download-question you first have to know that due to security restrictions there's no access to the filesystem from JavaScript (aside some ActiveX-voodoo).
So to download and store files on the local filesystem you have to use the mechanism provided by the browser itself. I think you won't get very far with XMLHttpRequest, because it serves another purpose (loading page-contents).
You have to reference a resource on the server using a standard href-hyperlink or a form-button. When the user clicks on the link the server will response with a certain header information in the response which leads the browser to show the "save as.."-dialog. I'm a little vague on that field but I think you gotta make sure that the server responses with a "content-type" like "application-x/text" or similar... however the trick is not to make the browser display the content, but rather to offer a download-dialog.
For the upload you need to "inject" a form into your HTML-page that contains an input-element of type "file". When you submit this form from within JavaScript you can upload a file to the server (given that the server is capable of handling the upload). Have a look at the qooxdoo-contributions so you don't have to reinvent the wheel.
Hope that helped...
cheers,
Lothar
-------- Original-Nachricht --------
> Datum: Sat, 19 Jan 2008 02:25:06 -0800 (PST)
> Von: jhonny thio <jhonnythio@...>
> An: Qooxdoo <qooxdoo-devel@...>
> Betreff: [qooxdoo-devel] How to get file from server (Download) ?
> hi, my name is Jhonny..
>
> First i want to say thank you very much to Lothar Kaiser that have help me
> a lot..
>
> i want to ask something again ...
> now, i am making an small application.
> In this application, the client can download data like *.txt, *.jpg and
> the other from the server..
> how to make the download process?
>
> i have read something about qx.io.remote.Request, but i dont understand..
> is it true if qx.io.remote.Request can make download process?
>
> My simple code :
>
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
> <title>Quickstart</title>
>
> <script type="text/javascript">
> qxsettings = { "qx.application" : "Application" };
> </script>
> <script type="text/javascript" src="script/qx.js"></script>
>
> <script type="text/javascript">
> qx.Class.define("Application",
> {
> extend : qx.application.Gui,
>
> members :
> {
> main : function()
> {
>
> this.base(arguments);
> var button1 = new qx.ui.form.Button("Download");
>
> button1.addToDocument();
>
> button1.addEventListener("execute", function(e) {
> /**
> if this button is pushed, will download File where the
> location = "File Manager/myfile.txt" in the server.
>
> *//
> });
>
>
> }
> }
> });
> </script>
>
>
> </head>
> </html>
>
> How to make the downloading process?
>
> And, anybody know how to upload file too? does it need
> qx.io.remote.Request too?
>
> Thanks,
>
> Jhonny
>
>
>
>
>
>
> ____________________________________________________________________________________
> Looking for last minute shopping deals?
> Find them fast with Yahoo! Search.
> http://tools.search.yahoo.com/newsearch/category.php?category=shopping
|