sticks
10-16-2002, 08:45 PM
Hi all.
I have tried and tried to fix this but as I'm a newbie I'm having no luck. Got this setup/script made for us - paid a small amount - but am having this one problem.
When I add a product we are supposed to browse for image which it uploads but just the path/image name is stored in database.
The error I get is:
Warning: Unable to create '/var/www/images/uploads/coaster.jpg': No such file or directory in /home/holidays/public_html/admin/addproduct.php on line 316
Warning: Unable to move '/tmp/phpMaCLxK' to '/var/www/images/uploads/coaster.jpg' in /home/holidays/public_html/admin/addproduct.php on line 316
product added successfully
The code for connect.php (which includes the path) is:-
<?
define('UploadDir', $_SERVER['DOCUMENT_ROOT'] . '/images/uploads/' ); // replace /familytravel/images/upload with the path to your upload directory.
define('DBUploadDir', '/images/uploads/'); // replace /familytravel/images/upload with the path to your upload directory. this will be used in URLS
$cnx = @mysql_connect('localhost', 'user', 'password');
if(!$cnx) {
echo('Failed to log into database at this time');
}
$select = mysql_select_db('holidays_dest');
if(!$cnx){
echo('failed to select database');
}
function dateSplit($date)
{
//$splitdate[0] = year
//$splitdate[1] = month
//splitdate[2] = day
$splitdate = explode("-", $date);
return $splitdate;
}
?>
The line 316 of addproduct.php referred to in the error message is:-
move_uploaded_file($_FILES['files']['tmp_name'], UploadDir . $_FILES['files']['name']);
I have changed the path about a million times and the code for connect.php is what should apparantly work but doesn't.
Thanking you for any help, Sheryll.
I have tried and tried to fix this but as I'm a newbie I'm having no luck. Got this setup/script made for us - paid a small amount - but am having this one problem.
When I add a product we are supposed to browse for image which it uploads but just the path/image name is stored in database.
The error I get is:
Warning: Unable to create '/var/www/images/uploads/coaster.jpg': No such file or directory in /home/holidays/public_html/admin/addproduct.php on line 316
Warning: Unable to move '/tmp/phpMaCLxK' to '/var/www/images/uploads/coaster.jpg' in /home/holidays/public_html/admin/addproduct.php on line 316
product added successfully
The code for connect.php (which includes the path) is:-
<?
define('UploadDir', $_SERVER['DOCUMENT_ROOT'] . '/images/uploads/' ); // replace /familytravel/images/upload with the path to your upload directory.
define('DBUploadDir', '/images/uploads/'); // replace /familytravel/images/upload with the path to your upload directory. this will be used in URLS
$cnx = @mysql_connect('localhost', 'user', 'password');
if(!$cnx) {
echo('Failed to log into database at this time');
}
$select = mysql_select_db('holidays_dest');
if(!$cnx){
echo('failed to select database');
}
function dateSplit($date)
{
//$splitdate[0] = year
//$splitdate[1] = month
//splitdate[2] = day
$splitdate = explode("-", $date);
return $splitdate;
}
?>
The line 316 of addproduct.php referred to in the error message is:-
move_uploaded_file($_FILES['files']['tmp_name'], UploadDir . $_FILES['files']['name']);
I have changed the path about a million times and the code for connect.php is what should apparantly work but doesn't.
Thanking you for any help, Sheryll.