Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: HTTP Status 302 in JUploader V 3.4  (Read 12065 times)

0 Members and 1 Guest are viewing this topic.

JoUploader

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
HTTP Status 302 in JUploader V 3.4
« 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
Logged

etienne_sf

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 908
    • Wiki
Re: HTTP Status 302 in JUploader V 3.4
« Reply #1 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/

Etienne
Logged

JoUploader

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: HTTP Status 302 in JUploader V 3.4
« Reply #2 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
Logged
Pages: [1]   Go Up
 

Page created in 0.035 seconds with 19 queries.