So, does this mean it's working for you now? If so, would you mind
sharing? :)
-Filip
Michael Lake skrev:
Filip -
You are exactly right. The session id wasn't being passed - and shame on
me for not actually comparing the "t:formdata" values because they are
indeed the same even when using the normal <t:form><t:upload /></t:form>
multiple times.
Thank you and thanks to Francois Armand for showing me how to tease the
session id out of tapestry.
-mike
Filip S. Adamsen wrote:
Hi,
Are you sure that using the same t:formdata is what's causing the
issue? There seems to be a Flash bug that causes SwfUpload to send
the wrong session id with the request. Could this be why your session
persisted list isn't behaving as expected?
-Filip
Michael Lake skrev:
I'm working on a project where I need multiple files (40 - 50) to be
uploaded from a single page.
The "tapestry-upload" module is unsuitable because the "t:upload"
component only allows you to select one file at a time. Selecting 50
files from the "browse for file" dialog one at a time would be quite
frustrating for the user.
Doing a bit of searching, I found that the open source project
SwfUpload ( http://swfupload.org ) is an ideal utility for uploading
multiple files because it allows you to select multiple files (using
shift/ctrl) in the "browse for file" dialog.
There's a demo here: http://demo.swfupload.org/v102demo/
The way it works is by separately submitting a POST request for each
of the queued files to a server-side location *using flash*.
To have a server-side location to post the file to, I've got an
invisible <t:form> with a <t:upload> inside.
When tapestry outputs a t:form to the client side it also adds a
hidden form field called "t:formdata" which looks something like this:
<input name="t:formdata" type="hidden"
value="H4sIAAAAAAAAAJXOsU4CQRAG4JGAjVQk...KKhooYk9PazO0Nx5K922Vn1sOGR+EJ">
Tapestry pukes without it, but fortunately swfupload allows us to
tack on extra POST params via javascript. For testing purposes, i'm
grabbing this "t:formdata" value from the DOM to send with each
request made by swfupload.
On the server side, for each file upload request, i'm adding the file
to an ArrayList<UploadedFile> object which is annotated
@Persist("session")
I can successfully add files to that arraylist by making my invisible
form visible again - submitting one file at a time, my onSuccess
returning null to bring me back to the same page for another upload.
However, when I mimic the form submission using swfupload, and use
the same "t:formdata" value with each request, my arraylist object
forgets any previous uploads.
I'm somehow not surprised - it seems I need to have a new
"t:formdata" value for each file uploaded by swfupload.
Now I'm stuck. perhaps I could do something stupid like refresh my
invisible form using the zone component after each file gets uploaded
by swfupload so I could perhaps get a new t:formdata value. I don't
think I could bring myself to do that.
Should I even be bothering with trying to piggyback off the
<t:upload> component?
Does anyone have an ideas? Or does someone already have a tapestry
component to handle selecting multiple files in one go? I know I
can't be the only person who needs this utility.
Thanks,
Mike
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]