Jump to content

how pass array of <input type='file'> with prototype.js


Jawed

Recommended Posts

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........

Link to comment
https://forums.phpfreaks.com/topic/118618-how-pass-array-of-with-prototypejs/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.