0

If i submit using <input:text>, i can see the result but if i use <input:file>. i cannot upload.

jquery code;

// JavaScript Document
	 $(document).ready(function(){
	 
	 $("#myformcom").submit(function(){
	 		
			var str=$(this).serialize();
			//var result;
			
			$.ajax({
			type: "POST",
			url: "uploadfiles.php",
			data: str,
			success:function(msg)
			{
			
				$("#error").ajaxComplete(function(event,request,settings)
				{
				
					if(msg=='Successfully Submitted')
						{
							$(this).html(msg);
														
						}
					else{
							$(this).html(msg);
						}
						
					
						return true;			
				});
				
			}	
			});
			
			return false;
	 });
	 });
2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by pwinfrey
0

You cannot upload files via JavaScript and that is inclusive of AJAX. You could submit the form to a hidden iframe on the current page that will process the request. If you don't want to do that, I would recommend using Uploadify. It is a jQuery plug-in that incorporates Adobe Flash, enabling you to upload files via AJAX. Check it out @ http://uploadify.com.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.