$allowed_filetypes = array('.jpg','.gif','.bmp','.png','.pjpeg');
$max_filesize = 524288;
$upload_path = './images/';
$filename = $_FILES['pic']['name'];
$ext = substr($filename, strpos($filename,'.'), strlen($filename)-1);
if(!in_array($ext,$allowed_filetypes))
die('The file type is not allowed.');
if(filesize($_FILES['pic']['tmp_name']) > $max_filesize)
die('The file is too large.');
if(!is_writable($upload_path))
die('You cannot upload to the specified directory.');
if(move_uploaded_file($_FILES['pic']['tmp_name'],$upload_path . $filename))
echo 'Success, view the file here';
else
echo 'There was an error. Please try again.';
$prod = $_GET['id'];
$path = . $upload_path . $filename .
mysql_select_db("products", $con);
mysql_query("INSERT INTO prods SET path='$path' WHERE id='$prod'");
mysql_close
If I leave out the sql query and all of that, the script works fine. But when I add the sql parts, it doesn't. Help?
2007-12-16
02:27:04
·
3 answers
·
asked by
thepoor666
1
in
Computers & Internet
➔ Programming & Design
I replaced the query and it still doesn't work.
2007-12-16
03:02:22 ·
update #1