tags:

views:

73

answers:

1
$result = mysql_query("SELECT * FROM media WHERE path = '$target'");
if($row = mysql_num_rows($result)==1)
{
echo"<br />Sorry, there is already a file with that name on the server.<br     />Please press back on your browser and save the file under a different name.";
}else{

if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{
echo "The file ". basename( $_FILES['uploaded']['name']). " has been uploaded";
mysql_query("INSERT INTO media (id, related_page_id, type, title, copy, path, position, assets, time) VALUES ('', '$cat','$type','$name','','$target','$position','$id','$today')");

header("Location: edit.php?category=$cat");
exit();
echo $name;
}
else {
echo $today;
echo "<br />";
echo "Sorry, there was a problem uploading your file. Please press back on your browser and try again.";
}
}

The above code used to work. Now it will not let me upload files to ../uploads/ but it works fine if i upload to uploads/. Does anyone have any suggestions as to what i'm doing wrong? Thanks

EDIT

$target = "../uploads/";
+1  A: 

I know it sounds silly but are the permissions for the folder set up correctly?

Spikolynn
That's the thing. It used to work. It has only just become a problem
Drew
Damn folder permissions. One of my seniors changed them without telling me!
Drew
Glad to have helped. Enjoy :)
Spikolynn