Solved

AjaxUpload: why have to click twice?

Posted on 2010-11-28
2
1,255 Views
Last Modified: 2012-05-10
 Hi all,

The code below  uploads files to the server using AjaxUpload.2.0.min.js

But you need to click several times on the “Add File” button for the OS window (where to pick the file you want to upload) to show, instead of clicking just once.

Also,  if you click once in the link and then you move the mouse out of the red area and click (out of #upload_files), and  last you click back in the link, it works, the OS window opens .. but why do I have to do this? Is that AjaxUpload will not be initially bound in the .livequery call? then, how do I bound it?  

The .js are uploaded into github to make the code easy to test, but in the real case they are in my machine.

Thanks a lot
<head>
<style>
#upload_files{color: #fff; background:#F32201; border:1px solid #7E9DB9; padding:2px;}
</style>
   
<script type="text/javascript" src="https://gist.github.com/raw/6dd585079502f138d87e/7c243080233761859937d52195b670602731a379/jquery-1.4.2.min.js"></script>
                                       
<script type="text/javascript" src="https://gist.github.com/raw/eeb2fe78f63ab80b626d/5be66e749b19fbb5b7c8814bf72a98c083f2aaaf/jquery.livequery.min.js"></script>
   
<script type="text/javascript" src="https://gist.github.com/raw/826bff2445c8533dd7fc/797734455959ef27796b6770c95a7b39049ae6e9/AjaxUpload.2.0.min.js"></script> 
        
<script type="text/javascript">
      $(document).ready(function() {

	function uploadFiles(){   
		new AjaxUpload('#upload_files', {
			action: 'whereToUploadInServer.php',
  		});		
	
	}//end uploadFiles
	
	       $("#upload_files").livequery("click", function(e){
        e.preventDefault();
        uploadFiles();
        //debugger ;
    }); 
}); //end document ready

    </script>
    
 
  </head>
  <body>
       <div><a href="#" id="upload_files">Add File</a></div> <br>
       
  </body>

Open in new window

0
Comment
Question by:Dada44
  • 2
2 Comments
 

Accepted Solution

by:
Dada44 earned 0 total points
ID: 34229092
Hi again, could not make it work, cannot spend more time on it :(

If somebody have a similar problem, try using:
http://valums.com/ajax-upload/

Thanks for reading
0
 

Author Closing Comment

by:Dada44
ID: 34229096
Cannot spend more time on this issue and I've found a alternative that solves it. Thanks
0

Featured Post

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article you'll learn how to use Ajax calls within your CodeIgniter application. To explain this, I'll illustrate how to implement a simple contact form to allow visitors to send you an email through your web site.
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question