Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I'm using an image[] array from this form to upload 5 photos:Code: Select all
<?
$max_no_img=5; // Maximum number of images value to be set here
echo "<form method=post action=addimgck.php enctype='multipart/form-data'>";
echo "<table border='0' width='400' cellspacing='0' cellpadding='0' align=center>";
for($i=1; $i<=$max_no_img; $i++){
echo "<tr><td>Images $i</td><td>
<input type=file name='images[]' class='bginput'></td></tr>";
}
echo "<tr><td colspan=2 align=center><input type=submit value='Add Image'></td></tr>";
echo "</form> </table>";
?>Posted Form:
==========
The code works fine. But I'm seeing these warnings as I know I'm pretty sure I need to initialize/define my array, but I'm not sure how...I need to fix them.
Any help would be appreciated !
Code: Select all
Notice: Use of undefined constant images - assumed 'images' in C:\Program Files\Apache Group\Apache2\htdocs\test\heintzelmans\admin\process.php on line 435
Notice: Use of undefined constant name - assumed 'name' in C:\Program Files\Apache Group\Apache2\htdocs\test\heintzelmans\admin\process.php on line 435
Notice: Use of undefined constant images - assumed 'images' in C:\Program Files\Apache Group\Apache2\htdocs\test\heintzelmans\admin\process.php on line 443
Notice: Use of undefined constant tmp_name - assumed 'tmp_name' in C:\Program Files\Apache Group\Apache2\htdocs\test\heintzelmans\admin\process.php on line 443
Notice: Use of undefined constant images - assumed 'images' in C:\Program Files\Apache Group\Apache2\htdocs\test\heintzelmans\admin\process.php on line 435
Notice: Use of undefined constant name - assumed 'name' in C:\Program Files\Apache Group\Apache2\htdocs\test\heintzelmans\admin\process.php on line 435Code: Select all
<?php
$z = 1;
while(list($key,$value) = each($_FILES[images][name]))
{
if(!empty($value))
{
$filename = $value;
$add = "heavy_inventory/$filename";
// echo $_FILES[images][type][$key];
// echo "<br>";
copy($_FILES[images][tmp_name][$key], $add);
//chmod("$add",0777);
createthumb('heavy_inventory/'.$filename,'heavy_inventory/t_'. $filename,61,44);
///////////////////////////////////////////////////////////////////
$temp = "photo".$z;
//echo "photo".$z;
///////////////////////////////////////////////////////////////////
$sql = "update heavy_inventory set $temp='$filename' where ref_id=".$ref_id;
//echo $sql;
$result=mysql_query($sql);
$z++;
}
}
?>JayBird | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]