Image Upload with Mootools

Posted by notme on Stack Overflow See other posts from Stack Overflow or by notme
Published on 2010-11-27T06:02:08Z Indexed on 2012/09/03 15:38 UTC
Read the original article Hit count: 126

Filed under:
|
|

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!

<form id="uploadphoto_pod" action="upload.php" enctype="multipart/form-data" method="post">
<input type='file' id='uploadphoto' name='uploadphoto'/>
<input type="submit" class="submit" name="add_product" value="Upload" />
  </form>
   <div id="response"><!-- Ajax Response --></div>
<script type="text/javascript">
 window.addEvent('domready', function(){
$('uploadphoto').addEvent('submit', function(e) {
    //Prevents the default submit event from loading a new page.
    e.stop();
    //("this" refers to the $('uploadphoto') element).
    this.set('send', {onComplete: function(response) {
        $('response').set('html', response);
    }});
    //Send the form.
    this.send();
});
});
   </script>

© Stack Overflow or respective owner

Related posts about php

Related posts about upload