Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am getting 500 internal Server Error here when uploading a file to the database inside the website image path folder.

In localhost same code is working but if I run the same application on Live site, i am getting 500 error.

*Checked permission of directory, it's 777

Please help me out with this problem.

Thanks in advance!

What I have tried:

$uploadfile = 'manuscript/';

$file_name = $_FILES['mdoc']['name'];
$file_size =$_FILES['mdoc']['size'];
$file_tmp =$_FILES['mdoc']['tmp_name'];
$file_type=$_FILES['mdoc']['type'];
$x=explode('.',$file_name);
$file_name=$id.'-'.$x[0].'.'.$x[1];
//$moved = move_uploaded_file($file_tmp, $uploadfile.$file_name);
if (move_uploaded_file($_FILES['mdoc']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Upload failed";
}
Posted
Comments
Peter_in_2780 3-Apr-18 3:04am    
I'm pretty sure you can't move a file to a directory like that. You have to specify the destination file name. Something like you have in the commented-out line $uploadfile.$file_name .

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900