By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,278 Members | 1,358 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,278 IT Pros & Developers. It's quick & easy.

uploading multiple files

P: 44
hi everyone
i have a problem with uploading two files at the at the same time.
cause the code below tells me that invalid supply argument forach.
[php]
destfile = /pathe/to/directory;
foreach ($_FILES["uploaded"]["error"] as $key => $error)
{
if ($error == UPLOAD_ERR_OK)
{
$tmp_name = $_FILES["uploaded"]["tmp_name"][$key];
$name = $_FILES["uploaded"]["name"][$key];
if(move_uploaded_file($tmp_name, $destfile ))
{
echo"copied successfully to:".$destfile."<br>";
}
else
{
echo"failed to copy the files to:".$destfile."<br>";
}

}
}[/php]

After so many posts (31) you know that you must include all code within the appripriate code tags. - moderator
Feb 29 '08 #1
Share this Question
Share on Google+
4 Replies


Markus
Expert 5K+
P: 6,050
Can't see anything wrong with it..
Can you post the form?
USE CODE TAGS.
Feb 29 '08 #2

hsriat
Expert 100+
P: 1,654
Line 8:[php]if(move_uploaded_file($tmp_name, $destfile."/".$name))[/php]
Feb 29 '08 #3

Markus
Expert 5K+
P: 6,050
Line 8:[php]if(move_uploaded_file($tmp_name, $destfile."/".$name))[/php]
Nice spot, but it was a problem with the foreach arguments?
Feb 29 '08 #4

hsriat
Expert 100+
P: 1,654
Line 1:[php]$destfile = "/pathe/to/directory";[/php]

@Mark, may be not ... :-/
Feb 29 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.