Hi all…i have a problem in uploading multiple files
my file uploading page has a form with code
<?php for($i=0;$i<num;$i++) //<-------------------------------------------num determined at runtime
{
echo 'Upload file :'; ?>
<input name="userfile[]" type="file" />
<?php } ?>
I submit it and for handling this i used:
I have a folder ‘uploads’
<?php
$uploads_dir = '/uploads';
foreach ($_FILES["userfile"]["name"] as $key => $name) {
{
$tmp_name = $_FILES["userfile"]["tmp_name"][$key];
$name = $_FILES["userfile"]["name"][$key];
move_uploaded_file($tmp_name, "$uploads_dir/$name");
}
}
?>
but i get the error message
[B]Warning: move_uploaded_file(/uploads/5.l) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/harsh/public_html/testroom/fileContainer.php on line 7
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move ‘/tmp/phpfGSibR’ to ‘/uploads/5.l’ in /home/harsh/public_html/testroom/fileContainer.php on line 7[/B]
please help me out of it…I am not sure if the file handling code is correct because i copied and modified a code from php.net