Problem with Valum's Ajax Upload JS file

Discussion in 'JavaScript' started by mcarter, May 15, 2010.

  1. #1
    I'm using Valum's Ajax upload (ajaxupload.3.2.js) on my website for users to upload video and pictures. The page for uploading pictures works fine, but the page to upload video doesn't. Oddly, the script appears runs just fine and says "uploading" and eventually shows the file as uploaded. But the file doesn't end up on my server. I have checked permissions on the folder, and that's not the problem. I think it's the javascript in the HTML, not the external js file.

    I think the javascript (which I didn't write myself) is only allowing picture files to be uploaded. Is this the case? If so, how can I delete that part of the code?

    I can supply the URLs if necessary.

    <script type= "text/javascript">/*<![CDATA[*/
    $(document).ready(function(){
    
    	
    	var button = $('#button1'), interval;
    	new Ajax_upload(button,{
    		
    		action: 'upload2.php', 
    		name: 'file',
    		onSubmit : function(file, ext){
    					
    			button.text('Uploading');
    			
    			
    			this.disable();
    			
    			
    			interval = window.setInterval(function(){
    				var text = button.text();
    				if (text.length < 13){
    					button.text(text + '.');					
    				} else {
    					button.text('Uploading');				
    				}
    			}, 200);
    		},
    		onComplete: function(file, response){
    			button.text('Upload');
    						
    			window.clearInterval(interval);
    						
    			
    			this.enable();
    			
    			
    			$('<li></li>').appendTo('#example1 .files').text(file);						
    		}
    	});
    
    	
    	new Ajax_upload('#button2', {
    	
    		action: 'upload2.php', 
    		data : {
    			'key1' : "This data won't",
    			'key2' : "be send because",
    			'key3' : "we will overwrite it"
    		},
    		onSubmit : function(file , ext){
    		
    			if (ext && /^(jpg|png|jpeg|gif)$/.test(ext)){
    			
    				this.setData({
    					'key': 'This string will be send with the file'
    				});
    				
    				$('#example2 .text').text('Uploading ' + file);	
    			} else {
    				
    				
    				$('#example2 .text').text('Error: only images are allowed');
    			
    				return false;				
    			}
    	
    		},
    		onComplete : function(file, response){
    			$('#example2 .text').text('Uploaded ' + file);				
    		}		
    	});
    	
    
    });/*]]>*/</script>
    HTML:

     

    Attached Files:

    mcarter, May 15, 2010 IP