I'm having problems with the following script:
I keep getting the following errors:
Warning: move_uploaded_file(../25.doc): failed to open stream: Permission denied in /Users/joanna/Sites/rcvf/admin/control_pictures.php on line 71
Warning: move_uploaded_file(): Unable to move '/var/tmp/phpM6J3wA' to '../25.doc' in /Users/joanna/Sites/rcvf/admin/control_pictures.php on line 71
I'm running this script on my personal computer (a MAC running OS X.2). Is there any reason why I shouldn't have permission to copy the file to a folder inside my Sites folder? Or does this not realy have anything to do with permissions?
I'll be gratfull for any help you can give -- this has been driving me crazy!
Jonathan
Code:
if (isset($_POST['submit_picture']))
{
//
// check the caption variable
if (empty($_POST['caption']))
{
$c = '';
}
else
{
$c = $this->escape_data($_POST['caption']);
}
if (empty($_FILES['upload']['name']))
{
$u = FALSE;
$this->message('<p>You forgot to choose a file.</p>');
}
else
{
$u = $_FILES['upload'];
}
$this->connect_to_mysql('2');
$name = "{$_FILES['upload']['name']}";
$query = "INSERT INTO pictures (picture_id, file_name, caption, orientation, year, upload_date) VALUES ('NULL', '$name', '$c', 'V', '{$_POST['year']}', 'NULL')";
$result = mysql_query($query);
if ($result && $u)
{
$extension = explode ('.', $_FILES['upload']['name']);
$uid = mysql_insert_id();
$filename = $uid.'.'.$extension[1];
if (move_uploaded_file($_FILES['upload']['tmp_name'], "../$filename"))
{
$this->message('Your picture has been added to the pictures page.</p>');
}
else
{
$this->message('<p>The file could not be moved.</p>');
$query = "DELETE FROM pictures WHERE picture_id = $uid";
$result = mysql_query($query);
}
}
else
{
$this->message('<p>Please try again.</p>');
}
}
Warning: move_uploaded_file(../25.doc): failed to open stream: Permission denied in /Users/joanna/Sites/rcvf/admin/control_pictures.php on line 71
Warning: move_uploaded_file(): Unable to move '/var/tmp/phpM6J3wA' to '../25.doc' in /Users/joanna/Sites/rcvf/admin/control_pictures.php on line 71
I'm running this script on my personal computer (a MAC running OS X.2). Is there any reason why I shouldn't have permission to copy the file to a folder inside my Sites folder? Or does this not realy have anything to do with permissions?
I'll be gratfull for any help you can give -- this has been driving me crazy!
Jonathan