Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How To call Function C on click of cancel button...
C#
function A(a)
{
	function B(b)
	{
		function C()
			{
				//It will do function for abort file..
			}//C

		return Xhr;
	}//B
}//A

//on every file selection
   $("input[type=file]").live("change",function(){
   var obj = this;
   xhr1 = A(obj);

 $(".CancelUpload").live("click",(function () {
//How To call function C() for abort file;
// I also tried xhr1.abort(); but it call for first cancel button not for current cancel button of 
file which is uploading
 }));
                           
 }); 
Posted
Updated 20-Dec-11 20:04pm
v2

1 solution

JavaScript
function A(a)
{
	function B(b)
	{
		function C()
			{
				self.Close();//It will do function for abort file..
			}//C
		return Xhr;
	}//B
}//A
//on every file selection
   $("input[type=file]").live("change",function(){
   var obj = this;
   xhr1 = A(obj);
 
 $(".CancelUpload").live("click",(function () { a().b().c()
or self.close();
 }));
                           
 });
 
Share this answer
 
v2
Comments
vishal_h 21-Dec-11 4:42am    
Thank you..but this is my link where exact scenario is required..i tried your sabove solution but its not working...can you help me on belowlink..
http://www.codeproject.com/Questions/303340/Abort-file-upload-on-click-of-cancel-button-in-htm
Tanveer A 21-Dec-11 23:45pm    
$(".CancelUpload").live("click",(function () {
xhr = new XMLHttpRequest();
xhr.abort();
});
vishal_h 22-Dec-11 0:43am    
I tried it already but it will abort on click of first cancel button instance..
I am providing seperate cancel button for each file upload progress for that file only...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900