Cancel an upload with chunks files

Upload core product.
Post Reply
skum3
Posts: 7
Joined: Fri Jan 02, 2009 10:55 pm

Cancel an upload with chunks files

Post by skum3 »

Hi, when I cancel an upload of a chunked file, for example if I cancel on the third of five chunks, upload cancels well, but the two chunks created and uploaded before I hit the cancel button are on my ftp server. I would like when I cancel a file upload, there is not chunks files uploaded on my ftp server, is it possible? I use JFileUpload 2.2 and your php sample. Thanks !

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

Re: Cancel an upload with chunks files

Post by support »

You would like to delete the 2 chunks on server, correct ?
I think it should be possible if you're able to detect the connection closing in the FTP script. If you can catch this event then you can check for orphan chunks and delete them.

vlad
Posts: 82
Joined: Sun Jan 04, 2009 6:38 pm

Re: Cancel an upload with chunks files

Post by vlad »

@skum3: You could also use JSAPI addon (http://www.jfileupload.com/products/tools/index.html), to have the JavaScript function "JSTransferCancelled" make a simple request to your server (Ajax or whatever), something like "http://www.yourserver.com/the-upload-sc ... ter_cancel".

@support: Speaking of canceling a chunked upload, there is an annoying behavior that disables the cancel button each time a chunk is uploaded. I'm using the chunk feature seamlessly, with a relatively small chunk size. This makes it difficult for the user to cancel the upload, as the button gets disabled and enabled very fast. You can cancel the upload only by clicking the button repeatedly hoping that you will catch it enabled (it's like the children game where you need to smack a popping animal in the head with a rubber hammer :-D).

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

Re: Cancel an upload with chunks files

Post by support »

Are you using "chunkmode=onfly" ? It should not create chunk on disk so disable period for "Cancel" button should be 0.1 second so you should be able to cancel the upload (except if your upload is also 0.1 second).

vlad
Posts: 82
Joined: Sun Jan 04, 2009 6:38 pm

Re: Cancel an upload with chunks files

Post by vlad »

Yes, I'm using the "onfly" "chunkmode" feature, I am not sure where the temporary pieces are stored and I didn't want the users to notice temporary files on their computers.
The "Cancel" button gets difficult to press when using a small chunk size over a fast connection.

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

Re: Cancel an upload with chunks files

Post by support »

With "onfly" it's in memory, so you will never see temporary files. I understand the issue with small chunks. Let me see how to improve it in 2.3.

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

Re: Cancel an upload with chunks files

Post by support »

I've just added the following property in i18n.properties of release 2.3:
#progress.button.cancel.enabling.behavior=lazy

You will just have to uncomment it and it should work as you need. I'm going to send an email with a testing version.

Post Reply