i use swfupload,i found a problem:
when i upload a file from swf to my jsp file or struts xxx.do action,
i can not get the post FILEDATA and other POST var
that is swf file can not accept the jsp file session
what's wrong ?
HELP ! thx
i use swfupload,i found a problem:
when i upload a file from swf to my jsp file or struts xxx.do action,
i can not get the post FILEDATA and other POST var
that is swf file can not accept the jsp file session
what's wrong ?
HELP ! thx
December 13, 2007 - 1:45pm
You didn't provide very much detail so it's very hard to know how to help.
First try building a simple HTML upload page (no JSP other than what you need to initialize a session) and see if it works. This verifies that uploads are being accepted.
Second, if you are using Tomcat and have Apache's mod_security enabled then you could be having a problem with Flash Players malformed mime posting and you have to disable the post validation see http://www.michaelphipps.com/2007-01-31/aflax-flash-upload-error-403.htm... or google "Flash Upload mod_security"
Third, Flash Player does not send cookies in some browsers. You have to pass your Session ID in the URL or as part of the post and manually restore the session. I'm not familiar with JSP so don't know how to do this but a Google Search should turn up something.
February 12, 2008 - 6:09am
Hi,
I am trying to implement a JSP/Struts solution instead of using PHP. Is there any examples of this? Did you have any joy getting your solution to work longware?
Rgds,
Ritchie.
February 12, 2008 - 12:07pm
I have a JSP struts solution working though I'm afraid I'm not at liberty to share it
.
In my case, I retrofitted SWFUpload into an existing application that used to use a plain Browse button (single-select), and did a POST to a particular struts action which uses the standard struts fileUpload interceptor. Struts provides the necessary code to wrap a MultiPartRequest (MultiPartRequestWrapper, JakartaMultiPartRequest): there's very little that you have to do. By the time your action is called, you already have a "File" object that points to a temp file location on your server. I presume the apache struts website has sample code on how to get a file upload working with struts. Once you have that working, you can just tell SWFUpload to use that URL (the one for the struts action) to post to.
SWFUpload will generate a new POST request for each file in the queue, so it was (comparatively) easy to retrofit SWFUpload at least from the struts point of view. My only problem was with FireFox, where cookies are not passed properly, so the session got lost. I was able to gather the cookies on the browser side and append them to my request URL. I had to add a new struts interceptor that will pull these parameters off the url and turn them back into cookies to restore the session. This was trivially easy.
The folks who own SWFUpload are not JSP/struts-savvy. They are PHP folks
.
February 12, 2008 - 1:43pm
Actually we're ASP.Net folks but most of our users use PHP and we've been offered free hosting on PHP servers. So there you go, PHP demos. Definitely not JSP/Strusts savvy.
Implementing SWFUpload in ASP.Net sounds similar to implementing in JSP (except we aren't using a MVC pattern).
We have to intercept the session value and turn it back in to a cookie for Firefox. Other than that the framework gets the file and by the time our code is called up we have a File object to work with, the same as if a <input> browser was used.