SibSoft Ltd.
Development Services
software products
 RegisterRegister    SearchSearch   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
EZYWebhost - Cheap XUpload & XFileSharing 100% campatible hosting

AJAX upload progress bar

File sharing script
[Solved] Use javascript fct instead of url_post

 
Post new topic   Reply to topic    SibSoft Ltd Forum Index -> XUpload
View previous topic :: View next topic  
Author Message
cyriltra



Joined: 02 Jul 2007
Posts: 5

PostPosted: Jul 25, 2008 10:00 am    Post subject: [Solved] Use javascript fct instead of url_post Reply with quote

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
View user's profile Send private message
PilgrimX182



Joined: 22 Mar 2006
Posts: 1055
Location: Undisclosed location

PostPosted: Jul 25, 2008 11:14 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website AIM Address
cyriltra



Joined: 02 Jul 2007
Posts: 5

PostPosted: Jul 26, 2008 7:13 am    Post subject: Reply with quote

Thanks a lot PilgrimX182, it works perfectly Smile

Cyril
Back to top
View user's profile Send private message
giorrrgio



Joined: 04 Aug 2008
Posts: 5

PostPosted: Aug 19, 2008 3:41 pm    Post subject: Reply with quote

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
View user's profile Send private message
PilgrimX182



Joined: 22 Mar 2006
Posts: 1055
Location: Undisclosed location

PostPosted: Aug 20, 2008 6:34 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website AIM Address
Display posts from previous:   
Post new topic   Reply to topic    SibSoft Ltd Forum Index -> XUpload All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group