ok i have a problem and it does not seem to be the php.ini problem.
what would cause my upload script for files to not completely execute and then just show me a blank page. not file uploaded and no record to the DB.
i am giving the upload code to see if there is a problem in it.
$id = $_GET['id'];
$file = $_FILES['document']['name'];
$docname = $_POST['docname'];
if ($file == '') {
echo 'Please select a document to upload.';
echo '<br /><a href="javascript:history.go(-1);"><< Go Back</a>';
exit;
}
if ($docname == '') {
echo 'Please insert a document name so that you know what it is.';
echo '<br /><a href="javascript:history.go(-1);"><< Go Back</a>';
exit;
}
$filename = $file;
$filename=str_replace(" ","_",$filename);// Add _ inplace of blank space in file name, you can remove this line
$ext = substr(strrchr($filename, "."), 1);
$allowedExtensions = array("doc","xls","ppt","pdf");
if (!in_array($ext, $allowedExtensions)) {
echo "File type not allowed";
echo '<br /><a href="javascript:history.go(-1);"><< Go Back</a>';
exit;
}
$randName = md5(rand() * time());
$filename = $randName . '.' . $ext;;
$source = $_FILES['document']['tmp_name'];
$target = "documents/".$filename;
$add = "documents/$filename";
//echo $_FILES['images']['type'][$key];
// echo "<br>";
copy($_FILES['document']['tmp_name'], $add);
chmod("$add",0777);
$query = "INSERT INTO paperwork (file, name, company_id, file_id)
VALUES ('$filename', '$docname', '$company_id', '$id')";
$result = mysql_query($query);
if ($result) {
$message = 'Yay the query was successfully run555.';
}
else{
$message = 'Invalid query: ' . mysql_error() . "\n";
$message .= 'Whole query: <em>' . $query . '</em>';
die($message);
}
echo '<h3>The File Was Uploaded Successfully</h3>';
echo '<code><script language=javascript>setTimeout(\'parent.tb_remove(); parent.location.reload(1)\', 1500);</script></code>';
thanks in advanced