[thelist] PHP uploading an image PHP

Andrew Maynes andrew at humanbehaviour.co.uk
Mon Jan 27 03:31:01 CST 2003


Hi All

I am trying to upload an image using three php scripts addPicture.php upload.php
and uploadItem.php that just will not upload all permissions are set correctly..
http://www.bleubolt.co.uk/Cart/admin/addPicture.php any ideas why... here are
the three scripts

addPicture.php

<?
require("Cart.php");
Brand();
DBInfo();
Root();
commonHeader("$Company","Add A Picture");

blueFont("Arial","Select the product, and then SUBMIT!<br><br>");
echo "<TABLE BORDER=\"0\" CELLPADDING=\"10\" CELLSPACING=\"10\"><TR>";
echo "<FORM ACTION=\"./upload.php\" METHOD=\"POST\">";

echo "<tr><td>";
blueFont("Arial","Select An Item<br>");
echo "<select name=\"II\" size=\"1\">";
mysql_connect("$DBHost","$DBUser","$DBPass");
$result=mysql("$DBName","SELECT ItemID,ItemName,ItemSKU FROM Items ORDER BY
ItemName");
while ($row = mysql_fetch_row($result)) {
echo "<option value='$row[0]'> $row[1] - $row[2] </option>";
}
echo "</select></td></tr>";
echo "<tr><td align=\"center\"><INPUT TYPE=\"submit\" NAME=\"Submit\"
VALUE=\"Submit\"></form></TABLE>";

adminFooter($Relative);
?>


upload.php
<?
require( "Cart.php");
Brand();
DBInfo();
commonHeader( "$Company", "Picture Addition");

blueFont( "Arial", "<b>You can now upload a picture...</b><br><br>");
echo  "<FORM ENCTYPE=\"multipart/form-data\" ACTION=\"./uploadItem.php\"
METHOD=\"POST\">";
echo  "<INPUT TYPE=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"200000\">";
echo  "<INPUT TYPE=\"hidden\" name=\"ItemID\" value=\"$II\">";
blueFont( "Arial", "Send this file: ");
echo  "<INPUT NAME=\"image\" TYPE=\"file\">";
echo  "<INPUT TYPE=\"submit\" VALUE=\"Send File\"></FORM>";

blueFont( "Arial", "<p><b>This file MUST be a JPEG (jpg) image.</b>");

adminFooter($Relative);
?>

uploadItem.php

<?
require("Cart.php");
Root();
exec("mv $image '$WebRoot/images/".$ItemID.".jpg'");
Header("Location: $Relative/admin/index.php");
?>

Can someone point me in the right direction or spot why this is failing ?

Andrew





More information about the thelist mailing list