Javascript upload

1079432344000

Another frequently asked question in many a newsgroup or mailing list is "how do I upload files with javascript?" The answer is there isn't a straight forward way of doing it.

Why didn't I just say you can't do it? well nothing is impossible for a good programmer. For example before we came out with our SFTP applet most experts were calling this kind of software impossible to build. But that's Java, lets' get back to Javascript. (Another gripe is the number of people who post javascript questions in java groups)

Getting back to The javascript documentation does refer to an onDragDrop event that will be invoked when a file is dropped onto the browser. In order for your javascript to respond to this event it needs to be a signed javascript. Unfortunately the behaviour of signed scripts have all changed along with lots of other thigns in mozilla 1.4+ but it's not fully documented (yet).

Even if you managed to gain access to the files buy listening on the onDragDrop event, making a mime message that the server side upload handler can accept is a different kettle of fish.

At Rad Inks we were asked a few times if we can make a javascript uploader like Rad Upload on a couple of these occaisions we customized rad upload so that it will invoke a javascript event after upload completion. This approach does not involve signed javascripts (though the applet is signed)

On another occasion we went the other way, the upload routine in Rad Upload was invoked by a javascript - which is a round about way of uploading files with javascript.

comments powered by Disqus