Jawed Posted August 7, 2008 Share Posted August 7, 2008 hi to all I am unsing prototype.js for ajax. I am making a image/doc upload program. In which i am repeating the <input tpye='file'> option in a loop as desired by user. here's the code <?php for($i=1; $i<=$max_no_img; $i++){ ?> <tr> <td>Document <?php echo $i ?></td> <td><input type="file" name="images[]" /></td> </tr> <?php } ?> Now i want to pass the values for these three files with the help of ajax but its not sending... the code is function upload_documents() { new Ajax.Request("upload_doc.php", { method: 'post', postBody: '&images='+ $F('images'), onComplete: upload_documentsResponse }); } function upload_documentsResponse(req){ $('show_per').innerHTML= req.responseText; } and further more i now have a requirement for only 3 uploads then i removed the loop, made 3 files input tag then den submitted with ajax. Now came another problem when i am echoing the files name with $_POST[] , it is printing the whole file name but when i am using $_FILES['images1']['name'] it not printing anyting I know tat $FILES is a multidimensional array so i even tried printing with foreach statement then too its not printing anything. Thanks in advance for any help........ Quote Link to comment Share on other sites More sharing options...
bluebutterflyofyourmind Posted August 7, 2008 Share Posted August 7, 2008 you can't upload a file through ajax in the traditional method. you have to pass everything to an iframe. I suggest googleing, AJAX file upload and looking at some of those tutorials Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.