Go Back   CodingForums.com > :: Client side development > JavaScript programming > Ajax and Design

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-02-2010, 04:24 PM   PM User | #1
styks1987
New to the CF scene

 
Join Date: Aug 2010
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
styks1987 is an unknown quantity at this point
Mootools File Upload Ajax

I am creating an ajax uploader with mootools. When I remove the ajax and simply upload the form I get $_FILES with the file data present. But when I use the ajax version, the $_FILES super global is empty. Every other part of the form is present. It acts as if it does not send the image at all but only in the ajax version. Any help is appreciated.
Thanks!

Code:
<?php include('layout/head.tpl'); ?>
   <!-- ******CONTENT encompasses the ALL content****** -->
   <div id="content">
		<form id="add_pod" action="add_pod.php" enctype="multipart/form-data" method="post">
		<?php
			echo $form->input('category');
			echo $form->input('name');
			echo $form->input('src');
			echo $form->textarea('description');
			echo $form->textarea('short_description');
			echo $form->upload('image');
			//echo $form->upload('thumb');
		?>
		<input type="submit" class="submit" name="add_product" value="Add Product" />
		</form>
		<div id="response"><!-- Ajax Response --></div>
		<div class="clrboth"></div>
	</div><!-- end content -->
</div><!-- end wrapper -->
<!-- ******FOOTER****** -->
<script type="text/javascript">
window.addEvent('domready', function(){
	$('add_pod').addEvent('submit', function(e) {
		//Prevents the default submit event from loading a new page.
		e.stop();
		//("this" refers to the $('add_pod') element).
		this.set('send', {onComplete: function(response) {
			$('response').set('html', response);
		}});
		//Send the form.
		this.send();
	});
});
</script>
<?php include('layout/footer.tpl') ?>
styks1987 is offline   Reply With Quote
Reply

Bookmarks

Tags
ajax, file upload, mootools

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:07 AM.


Advertisement
Log in to turn off these ads.