Here's a little routine I use.  The server sends back some minimal JSON 
code that I extract from the iframe that the upload form was posted to.  
This is a condensed version.  If you need more of the code (html/js), let 
me know.

If there's a more prototype-y way to do 
"document.getElementsByTagName('body')[0]", please let me know and I'll 
change my code.

var Uploader = Class.create({
    initialize: function(form, target, dir, mgr) {
        this.form = form; = target;  //iframe
        this.dir = dir;
        this.mgr = mgr;
        $(this.form).observe('submit', this.upload.bind(this));
        $('load', this.complete.bind(this));
    upload: function() {
        // clear iFrame
        // build form
        var f = $(this.form);
    complete: function() {
        try {
            var c = 
            var res = c['success'];
        catch(e) {
            alert('Error.  File(s) not Uploaded');
      // evaluate res here.

You received this message because you are subscribed to the Google Groups 
"Prototype &" group.
To view this discussion on the web visit
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Reply via email to