Jump to content

Strange Warning on a PHP Script


Recommended Posts

Dear all,

I have the following code for storing an image in and fetching it from a MySQL DB:

 

<html>
<body>
<form action="index.php" method="POST" enctype="multipart/form-data">
File:
<input type="file" name="image"> <input type="submit" value="upload">
</form>
<?php
mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("code_new") or die(mysql_error());
$file = $_FILES['image']['tmp_name'];
if(!isset($file)) {
echo 'Please select a file';
} else {
$image = addslashes(file_get_contents($_FILES['image']['tmp_name']));
$image_name = addslashes($_FILES['image']['name']);
$image_size = getimagesize($_FILES['image']['tmp_name']);
if ($image_size == FALSE)
echo 'This is not an image.';
else {
if(!$insert = mysql_query("INSERT INTO lash VALUES ('', '$image_name', '$image')")) {
echo 'Problem uploading the image.';
} else {
$lastid = mysql_insert_id();
echo "Image uploaded.<p />Your Image:<p /><img src=get.php?id=$lastid>";
}
}
}
?>
</body>
</html>
No need to include get.php and the DB.
To test the if statement in red, I attempted to upload a pdf file and it functioned well. It also uploaded various images. But when I attempted to upload a docx file (word), the following occurred:
Warning: POST Content-Length of 9069583 bytes exceeds the limit of 8388608 bytes in Unknown on line 0
What is the meaning of this warning and what are the Unknown and line 0?
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...