Thursday, March 20th, 2008
Multiple File Uploads with Aptana Jaxer
Dealing with file uploads can be a test of a Web framework. I personally long for the input type="file"
to be improved with items such as multiple="true"
for multiselection, let alone showing the status of the upload (20% complete).
The Jaxer folks have posted on Easy File Uploading using Aptana Jaxer which shows how you can tinker in JavaScript to get everything you need in a very simple way:
To receive the data from the form when submitted we put some Jaxer code into the page the form will be submitted to. The code below should be in script block with a runat = ‘server’ attribute, which makes the code run serverside and doesn’t present it to the client so you don’t expose any serverside filenames or folder structures.
- <script type='text/javascript' runat='server'>
- var message = "";
- for (fileCount=0; fileCount < Jaxer.request.files.length; fileCount++){
- var fileInfo = Jaxer.request.files[fileCount];
- var destinationFilePath = Jaxer.Dir.resolvePath(fileInfo.originalFileName);
- fileInfo.save(destinationFilePath);
- message += "<br>" + [
- "Saved to : " + destinationFilePath
- , "original filename : " + fileInfo.originalFileName
- , "temp filename : " + fileInfo.tempFileName
- , "contentType : " + fileInfo.contentType
- , "size : " + fileInfo.fileSize
- ].join("<br />");
- }
- document.write(message);
- </script>





It’s still a suprise to me too that non of the big vendors (Microsoft, Sun, etc.) has really solved this problem with a good component. We are using ASP.NET and I tried to find a good upload component. But trying out over 20 different product, the results are rather sad. Specially Safari seems to cause great troubles. My quick and dirty evaluation can found here:
http://remy.supertext.ch/2008/01/file-upload-with-aspnet
I’m very interested in your experience?
This seems to be very simular to ASP.NET’s implementation.
@rblaettler: I use SWFUpload, I think it’s great. There are also ASP.NET demos.
@rblaettler: Sorry, just noticed the link on the bottom of your post.
I do like SWFUpload too, we use it internally now, but we just had too many issues on the public website with it. I think it’s not an SWFUpload but more of a Flash issues, even Flickr has an alternative Upload tool besides their Flash based tool.