javascript notification when file upload completes

Upload core product.
Post Reply
jitinj
Posts: 4
Joined: Fri Jul 11, 2008 12:25 am

javascript notification when file upload completes

Post by jitinj »

Hi,
Can I get an example on how to capture/handle javascript event when file transfer completes?
I downloaded JSAPI and the example is for HTTP upload but I am using FTP upload.
I tried to use JSTransferDone method but I think it needs to be registered first but I don't know how it work for ftp.

Thanks
Jitin
Last edited by jitinj on Mon Jul 14, 2008 3:00 am, edited 1 time in total.

User avatar
support
Posts: 1503
Joined: Sun Jan 27, 2008 6:19 pm

Re: javascript notification when file upload completes

Post by support »

You have to adapt the HTTP sample to FTP. Here are instructions:

1 - Declare JAR files for FTP instead of HTTP:
You have the replace the 3 occurrences of the line below:
lib/jfileupload.jar,lib/httpimpl.jar,lib/chttpclient.jar,lib/clogging.jar,lib/jsapi.jar
must be replaced by:
lib/jfileupload.jar,lib/ftpimpl.jar,lib/cnet.jar,lib/clogging.jar

2 - Switch mode parameter to FTP:
document.writeln('<PARAM NAME="mode" VALUE="http">');
document.write('mode="http" ');
becomes:
<PARAM NAME="mode" VALUE="ftp">
document.write('mode="ftp" ');

3 - Remove HTTP transfer related lines:
document.writeln('<PARAM NAME="paramfile" VALUE="uploadfile">');
document.writeln('<PARAM NAME="param1" VALUE="todo">');
document.writeln('<PARAM NAME="value1" VALUE="upload">');
and:
document.write('paramfile="uploadfile" ');
document.write('param1="todo" ');
document.write('value1="upload" ');

4 - Replace HTTP URL with FTP URL:
document.writeln('<PARAM NAME="url" VALUE="http://localhost:8080/upload/process.jsp">');
document.write('url="http://localhost:8080/upload/process.jsp" ');
by:
document.writeln('<PARAM NAME="url" VALUE="ftp://localhost">'
document.write('url="ftp://localhost" ');

5 - Setup FTP username/password:
document.writeln('<PARAM NAME="param1" VALUE="username">');
document.writeln('<PARAM NAME="value1" VALUE="yourFTPusername">');
document.writeln('<PARAM NAME="param2" VALUE="password">');
document.writeln('<PARAM NAME="value2" VALUE="yourFTPpassword">');

document.writeln('<PARAM NAME="param1" VALUE="username">'
document.write('value1="yourFTPusername" ');
document.writeln('<PARAM NAME="param2" VALUE="password">'
document.write('value2="yourFTPpassword" ');

Please try it and let me know if it helps.

jitinj
Posts: 4
Joined: Fri Jul 11, 2008 12:25 am

Re: javascript notification when file upload completes

Post by jitinj »

Thanks for your reply but this is not what I am looking for.

I am already using applet in ftp mode but th problem is using JSAPI in ftp mode.
None of the javascrupt events or methods defined in http example are firing when I convert it to ftp. More specifically I am interested in catching JSTransferDone event.

Any help would be appreciated.

Thanks
Jitin

User avatar
support
Posts: 1503
Joined: Sun Jan 27, 2008 6:19 pm

Re: javascript notification when file upload completes

Post by support »

It should. Please post here your script for FTP. You may forget the MAYSCRIPT tag that allows notification.

Post Reply