Jump to content

Why does this give a 500 error?


MrFish

Recommended Posts

I've got a file upload script for a site that does fine uploading image files and mp3s but trying to upload a wmv file causes a 500 error when calling the upload file.Here is the code:

<?php	include('../configuration.php');	mysql_connect(HOST, USER, PASS);	mysql_select_db(DATABASE);		$text = htmlspecialchars($_POST['text'], ENT_QUOTES);	$title = htmlspecialchars($_POST['title'], ENT_QUOTES);		if($_FILES["file"]["error"] > 0)	{		echo "An Error Occured: " . $_FILES["file"]["error"];		}	else	{		$file = $_FILES["file"];		$name = $file["name"];		$tmp = $file["tmp_name"];				$random = rand(0,999999999);		$writename = $random . "_" . $name;		$path = "media/$writename";				move_uploaded_file($tmp, "../" . $path);			echo "INSERT INTO media (title, text, file, type) VALUES ('$title', '$text', '$path', 'x')";					mysql_query("INSERT INTO media (title, text, file, type) VALUES ('$title', '$text', '$path', 'x')");		header("Location: mediapage.php");	}?>

The max_file_upload value is at 20MB so it should upload this 5.9MB WMV file. Is there something I'm missing?

Link to comment
Share on other sites

You can enable error logging if necessary to get the error message from PHP. You might need to enable error logging in a php.ini or htaccess file if the error happens during startup while it's procesing the uploaded file, before the code runs. Otherwise you can just use ini_set to enable error logging and use error_reporting(E_ALL) to make sure you're seeing all errors.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...