Ok, so before I go off to bed, I have good news and I have bad news...

The good news is that you can go grab the complete example webapp now:

http://www.zammetti.com/multifileupload.zip

The bad news however is that part of this doesn't appear to be possible... Those pesky scripting security issues we were talking about before DID come up, and I don't see a way around them, at least not as tired as I am :) So, the interface as I imagined it doesn't seem possible.

But, what you'll see here is an example of using a custom tag, <otx:MultiFileUpload>, that renders a form with a given number of file elements (given by the parameter maxNumberOfFiles). When the Upload button is clicked, it calls MultiFileUploadAction, which uses the MultiFileUploadParser class to grab all the files. The files are written out to a directory, and some data about the uploaded files is displayed back to the browser.

The MultiFileUploadParser is a faily independant class, it just has a static getFiles() method that returns an ArrayList, which contains a HashMap for each file containing details about it. At this point the files are in memory, so this has obvious scalability limitations. You can do whatever you want at this point with the files, but the example Action writes them to disk. They get written to c:\temp (this is assumed to be run on a Windows system). It's hard-coded in the example by the way.

But, ultimately, this doesn't meet your requirements. :( I am going to try and spend some time tomorrow trying to come up with a way to do the interface as I originally envisioned, but it doesn't seem possible at this point. If this is helpful to you, great, if not, maybe it would be to someone else. There's a number of things that are "wrong" with this code (it's Windows-centric, the parser should probably use a callback paradigm to avoid having everything in memory at once, etc.), but since it's not exactly what I was hoping for, I didn't see much point in making it perfect in every way EXCEPT meeting the ACTUAL goal :)

--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

Frank W. Zammetti wrote:
Ok, let me play a bit tonight and see what I can come up with. I'm more worried about the server-side processing than the front-end, but even that shouldn't be terrible. I'll let you know what I come up with tomorrow...





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to