Page 1 of 1

Needed JavaScript functionality.

Posted: Tue Feb 22, 2011 3:50 pm
by Kindred2k
I don't believe this has been covered in previous posts on the forum here.

I'm trying to do one of either of the following two things in jFileUpload on a Coldfusion 8 server:

1) When a file size exceeds "maxsize", I need to report the file's size to a JavaScript callback. Currently, the only way to get the file's size is to allow the transfer to begin and get the file's size through the JSTransferStarted() callback. JSTransferFailed() is called when a file size limit is flagged, but it only carries the error message (and optionally the {0} variable that contains the file size limit that was used to setup jFileUpload).

2) Allow the file upload momentarily to get the file size being uploaded and then cancel the upload. However, fully canceling the upload doesn't seem to be possible from JavaScript. Is there a way to properly shut down the applet or call a JavaScript function that will cancel the upload? I tried deleting the object from the DOM through JavaScript, but the applet continues to send file data in the background (verified by watching the FTP server status). If I could do this, I could then easily have an AJAX call to the server to delete the partially uploaded file.

Any help or guidance with either of these options would be greatly appreciated!

I seriously dig jFileUpload as it does offer a lot of control over uploads. I'm just looking for a tiny bit more control. :)

Thanks!

Ryan

Re: Needed JavaScript functionality.

Posted: Tue Feb 22, 2011 4:33 pm
by Kindred2k
NOTE: in reading another post I realized a way to solve #2. I'm now experimenting with loading jFileUpload in an iFrame which I will navigate away from if a file size restriction is met. The simplest approach is to simply reload the frame, including the filename of the file that was attempted for upload and have the server detect that filename on the URL in order to delete it from the temp upload area.

I'll post my success or failure with this approach. :)

Re: Needed JavaScript functionality.

Posted: Tue Feb 22, 2011 7:38 pm
by support
Are you using JFileUpload only or JFileUpload + JBatchUpload?