> Hi, I'm testing the form plugin and can't get the upload to work. It > just submits the page. I really don't know what I'm doing wrong. > Here's my code taken from the demo page. > > <form id="uploadForm" action="upload" method="POST" > enctype="multipart/form-data"> > <input type="hidden" name="MAX_FILE_SIZE" > value="100000" /> > File: <input type="file" name="file" /> > Return Type: <select id="uploadResponseType" > name="mimetype"> > <option value="html">html</option> > <option value="json">json</option> > <option value="script">script</option> > > </select> > <input type="submit" value="Submit" /> > </form> > > <script type="text/javascript"> > function upload(){ > alert('testing'); > return false; > > } > > $(document).ready(function(){ > photoUploadForm=$('#uploadForm'); > photoUploadForm.ajaxForm(); > photoUploadForm.submit(upload); > > }); > > </script>
There's nothing wrong with the code you posted. Can you post a link to the page that is having the problem? Here's a link to a page using the code you posted (slightly simplified): http://www.malsup.com/jquery/form/file-test3.html Mike