Question
Uploading images with PHP
I have the following markup on my page -
<?php
if(isset($_POST['Submit'])) {
foreach ($_FILES["drawings"]["error"] as $key => $error) {
if ($error == UPLOAD_ERR_OK) {
$tmp_name = $_FILES["drawings"]["tmp_name"][$key];
$drawingname = $_FILES["drawings"]["name"][$key];
$userName = $row_rsUser['fuserName'];
//echo($tmp_name."-".$drawingname."-".$userName);
move_uploaded_file($tmp_name,
"../images/users/$userName/$drawingname");
}
}
}
?>
...
<form id="form1" name="form1" method="post" action=""
enctype="multipart/form-data">
<p>Upload New Images:</p>
<p>
<input type="file" name="drawings[]" />
</p>
<p>
<input type="file" name="drawings[]" />
</p>
<p>
<input type="file" name="drawings[]" />
</p>
<input type="submit" name="Submit" value="Send" />
</form>
And when I submit, I get this -
Warning: Invalid argument supplied for foreach() in
W:\Webspace\resadmin\madison\madisonconcrete.com\www\manage\m_users_update.php
on line 77
I'm tapped - any ideas?
--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================
<?php
if(isset($_POST['Submit'])) {
foreach ($_FILES["drawings"]["error"] as $key => $error) {
if ($error == UPLOAD_ERR_OK) {
$tmp_name = $_FILES["drawings"]["tmp_name"][$key];
$drawingname = $_FILES["drawings"]["name"][$key];
$userName = $row_rsUser['fuserName'];
//echo($tmp_name."-".$drawingname."-".$userName);
move_uploaded_file($tmp_name,
"../images/users/$userName/$drawingname");
}
}
}
?>
...
<form id="form1" name="form1" method="post" action=""
enctype="multipart/form-data">
<p>Upload New Images:</p>
<p>
<input type="file" name="drawings[]" />
</p>
<p>
<input type="file" name="drawings[]" />
</p>
<p>
<input type="file" name="drawings[]" />
</p>
<input type="submit" name="Submit" value="Send" />
</form>
And when I submit, I get this -
Warning: Invalid argument supplied for foreach() in
W:\Webspace\resadmin\madison\madisonconcrete.com\www\manage\m_users_update.php
on line 77
I'm tapped - any ideas?
--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================
