| View previous topic :: View next topic |
| Author |
Message |
cyriltra
Joined: 02 Jul 2007 Posts: 5
|
Posted: Jul 25, 2008 10:00 am Post subject: [Solved] Use javascript fct instead of url_post |
|
|
Hello,
once the upload is completed, how can i call a javascript function (parameters will be the file name, size etc..) instead of posting the values to a php/cgi script ?
I'm using the latest pro version.
Thank you for your help
Kind Regards,
Cyril
Last edited by cyriltra on Jul 26, 2008 7:13 am; edited 1 time in total |
|
| Back to top |
|
 |
PilgrimX182

Joined: 22 Mar 2006 Posts: 1055 Location: Undisclosed location
|
Posted: Jul 25, 2008 11:14 am Post subject: |
|
|
In upload.cgi find thi part of code
| Code: | print"<HTML><BODY><Form name='F1' action='$url_post' target='_parent' method='POST'>";
for my $f (@files)
{
print"<textarea name='$_\[]'>$f->{$_}</textarea>" for @file_fields;
}
print"<textarea name='$_->{name}'>$_->{value}</textarea>" for @har;
print"</Form><Script>document.location='javascript:false';document.F1.submit();</Script></BODY></HTML>"; |
and replace it with
| Code: | print"<HTML><BODY><Script>";
for my $f (@files)
{
print"window.parent.my_func('$f->{file_name}','$f->{file_name_orig}','$f->{file_size2}','$f->{file_size}','$f->{file_status}');";
}
print"</Script></BODY></HTML>"; |
where my_func is your function defined on upload page. |
|
| Back to top |
|
 |
cyriltra
Joined: 02 Jul 2007 Posts: 5
|
Posted: Jul 26, 2008 7:13 am Post subject: |
|
|
Thanks a lot PilgrimX182, it works perfectly
Cyril |
|
| Back to top |
|
 |
giorrrgio
Joined: 04 Aug 2008 Posts: 5
|
Posted: Aug 19, 2008 3:41 pm Post subject: |
|
|
The javascript way it's ok, even with ajax calls, but I have an issue:
even after upload has finished I keep on receiving upload_status.cgi traffic (I found that with firebug). I guess I should manually stop that with some explicit javascript function calls.
Thanks |
|
| Back to top |
|
 |
PilgrimX182

Joined: 22 Mar 2006 Posts: 1055 Location: Undisclosed location
|
Posted: Aug 20, 2008 6:34 am Post subject: |
|
|
Try to add this before
| Code: | | print"</Script></BODY></HTML>"; |
| Code: | window.parent.frames['transfer'].location='blank.html';
window.parent.frames['transfer2'].location='blank.html'; |
this will reload progress bar iframes and stop ajax requests. |
|
| Back to top |
|
 |
|