Friday, January 6th, 2006
Dojo: Uploading files, and contents with Ajax
Dojo makes it very easy to submit forms with Ajax, using the dojo.io.bind() wrapper.
All you have to do is add formNode: document.getElementById('foo') to the argument object and you are set.
But what about uploading files?
Alex has written up file uploading with Dojo, where he shows us that we can simply add dojo.require("dojo.io.IframeIO"); to use the iframe IO transport, which is able to upload files.
He then posts about file upload… without the file!, which shows how you can send any stream of content up as though it is a file upload, using the XMLHttpTransport and:
dojo.io.bind({
url: "upload.cgi",
// we expect to get JSON back from this CGI
mimetype: "text/json",
// handle the returned JSON
load: function(type, data, evt){ },
// normal properties
content: {
foo: "bar",
baz: "thud"
},
// our file content
file: {
name: "upload.txt",
contentType: "plain/text",
content: "look ma! no form node!"
}
});












[...] NOTE: we talked about uploading files and contents with Dojo [...]
[...] Dojo toolkit’s new file uploading feature [...]
s
This is a kind of cheating. No one can upload files using AJAX. But ys little bit of cheating can make the process look like ajax stuff. good job.
There is not enough information about how to handle, upload and process multipart-formdata oriented file uploads. What I have found as example is :
file: {
name: “upload.txt”,
contentType: “plain/text”,
content: “look ma! no form node!”
},
But who will process the upload, what about multiple files???
ramanbasu@gmail.com
Ramaan,
You can check out my free script - I borrowed a lot of code for the server side scripts (check the copyright information in the files) but I totally rewrote the JavaScript because I was not happy with the way a lot of scripts out there handled the process or the freakin’ size of the things, either. Totally script size with proper compression is under 5KB! You can check it out by clicking on the link below.
Still trying to find a way to make it work for a client. :o(
file storage
http://www.Dead-Yahoo.com is a very dynamic, complex server that allows you to upload and download as many files as you can possibly imagine! With up to 2GB upload capacity that no other server allows, Dead-Yahoo is unquestionably the best on the net. Not onl…
Thtat wat i was looking for.