forum.coppermine-gallery.net

Support => cpg1.4 plugins => cpg1.4.x Support => Older/other versions => cpg1.4 JUpload by etienne_sf => Topic started by: JoUploader on July 21, 2008, 05:35:28 am

Title: HTTP Status 302 in JUploader V 3.4
Post by: JoUploader on July 21, 2008, 05:35:28 am
Dear All,

I use JUploader version 3.4.
I would like to upload multiple files using JUploader.

The page to upload files is uploadList.jsp, where I put the script to run the applet:
<applet name="JUpload" code="wjhk.jupload2.JUploadApplet"
         archive="plugins/jupload/wjhk.jupload.jar" width="636" height="500" mayscript>
             <param name="postURL" value="uploadMulti.jsp"/>
             <param name="stringUploadSuccess" value="SUCCESS">
                       <param name="stringUploadError" value="ERROR">
             Java 1.5 or higher plugin required.
</applet>

uploadMulti.jsp is mapped to actually a servlet (named UploadMultiServlet) to process to filter the uploaded files, write the files, write path of the files, date of upload to database etc, which can not be done in JSP.
Upon finishing upload process, it should be redirected to other page status.jsp, which shows upload result and other stuffs.
In the servlet:
if (uploadResult) {
   responseStr = "SUCCESS";
       response.sendRedirect("status.jsp?uploadResult=responseStr");
} else {
   responseStr = "ERROR";
       response.sendRedirect("status.jsp?uploadResult=responseStr");
}
in the page status.jsp, I wrote:
<% String uploadResult = request.getParameter("uploadResult"); %>
Upload Result = <%=uploadResult%>

I successfully upload the files and writing information to database, but the it can not be redirected to status.jsp, instead, alert (error message) appears:
 "Received HTTP Status 302 Moved Temporarily"

I would like to remove the error message and make it redirected to status.jsp.
If it is not possible, how can I disable button "Upload" in the applet, so that the files can not be re-uploaded?

I have been into this problem for some days and I can not find any answer elsewhere.
Thank you in advance for your advice.
Regards,

Jo
Title: Re: HTTP Status 302 in JUploader V 3.4
Post by: etienne_sf on July 21, 2008, 01:56:59 pm
Hi,

  I guess you're not using Coppermine at all.

Right ?


If so, you're at the wrong place. Support for the stand-alone applet is given here:
http://sourceforge.net/projects/jupload/ (http://sourceforge.net/projects/jupload/)

Etienne
Title: Re: HTTP Status 302 in JUploader V 3.4
Post by: JoUploader on July 22, 2008, 12:44:12 pm
Thanks Etienne for your prompt response.

You're right, I just realized that there's a difference between stand-alone and using Coppermine.
I downloaded it from SourceForge.net, and I think it's a stand-alone version.

I tried to change the:
public final static String DEFAULT_STRING_UPLOAD_SUCCESS = "";
in UploadPolicy and
modify checkUploadSuccess method in DefaultUploadPolicy to become:
if ((status != 200) && (status != 100) && (status != 302))
        throw new JUploadExceptionUploadFailed("Received HTTP status "
                    + msg);
it still didn't work.

However, I have found the answer, by adding the
<param name="afterUploadURL" value="javascript: nextUrl();">
in which nextUrl is a javascript function:
      function nextUrl() {
      F = document.formUpload;
      F.action = 'status.jsp';
      F.submit();
     }

Although there is still an alert about "SUCCESS", but it finaly redirected to "status.jsp".
I'll look for answers on the site you mentioned.
Thank you for your great plug-in!
Regards,

Jo