I am having serious issues uploading pdf files to my MySql database and into a directory since bringing my code from a Unix system using Apache to a Windows system running Apache. I can still upload images without a problem, the issue is strictly pdf files.
As I stated, this code works fine on my Unix server, but since I installed the XAMPP Package on my laptop, which is running Windows XP Professional, this code is no longer working. The pdf file name is not being inserted into the database and the pdf file is not going into the directory.
I am guessing it has something to do with this line"($file_type == "application/pdf")" or this line"$newfile = "../menus/".$file_name;". Can anyone give a hand on this one?
Here is the code:
<? } else {
//insert record in database
if (is_uploaded_file($file)) {
$badchararray = array(" ","'","\"","$","&","%","-","#");
$file_name = str_replace($badchararray, "_", $file_name);
$file_name = stripslashes(strtolower($file_name));
if ($file_type == "application/pdf") {
$newfile = "../menus/".$file_name;
if (!copy($file, $newfile))
{
print "Could Not Upload Your File.";
exit();
}
}
}
mysql_query("INSERT INTO menus SET title = '$title', file = '$file_name', content = '$content'");
?>