[thelist] PHP uploading an image PHP

Andrew Maynes andrew at humanbehaviour.co.uk
Mon Jan 27 07:28:01 CST 2003


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

I have changed it to:

if (is_uploaded_file($_FILES['image']['tmp_name']) {

move_uploaded_file($_FILES['image']['tmp_name'],"$Relative/images/$ItemID.jpg
");
}
else {
	// Error handling
}

http://www.bleubolt.co.uk/Cart/admin/addPicture.php

and bingo I get 3 error messages :(

Warning: Unable to create '/Cart/images/5.jpg ': No such file or directory in
/home/b/o/bolt/public_html/Cart/admin/uploadItem.php on line 8

Warning: Unable to move '/tmp/phphHKHaM' to '/Cart/images/5.jpg ' in
/home/b/o/bolt/public_html/Cart/admin/uploadItem.php on line 8

Warning: Cannot add header information - headers already sent by (output started
at /home/b/o/bolt/public_html/Cart/admin/uploadItem.php:8) in
/home/b/o/bolt/public_html/Cart/admin/uploadItem.php on line 15

The first error... I do have a directory called images and it is here
http://www.bleubolt.co.uk/Cart/images/ and chmod 755

beyond this I am at a loss :( could it be the path to the directory that is the
problem?

Andrew







More information about the thelist mailing list