XUpload - Error popup

Message
Author
moov
Posts: 1
Joined: Jun 12, 2007 6:46 pm

Error popup

#1 Postby moov » Jun 12, 2007 6:53 pm

Hi,

anytime when an error occurs while uploading (e.g. file size exceeded) the error message is shown by js (alert). instead of this i want to redirect the user to a specific error script (error.php) where the error message and some variables defined in the upload form (session, user name) should be shown. how can i solve this problem?

User avatar
PilgrimX182
Posts: 2186
Joined: Mar 22, 2006 1:39 pm

#2 Postby PilgrimX182 » Jun 13, 2007 6:06 am

In upload.cgi replace line

Code: Select all

print"<HTML><HEAD><Script>alert('$msg');</Script></HEAD><BODY><b>$msg</b></BODY></HTML>";
with

Code: Select all

my $cg = new CGI;
my $session_id = $cg->param('session_id');
my $username = $cg->param('username');
print"<HTML><HEAD><Script>document.location='http://mysite.com/error.php?session_id=$session_id&username=$username&msg=$msg';</Script></HEAD><BODY><b>$msg</b></BODY></HTML>";
where http://mysite.com/error.php is your error page and session_id & username are form fields on your upload_form.html