XAMPP cant uploading a image to my localhost database
Problem with uploading a image to my localhost database. I have just
install XAMPP version 3.2.1 for window(32) but iam useing the window 7
(64) can that be the problem? My Apcahe and MySQL is running. Iam useing
this code and yes my file is in the htdocs folder. everytime i try to
upload an image i get
Object not found! The requested URL was not found on this server. The link
on the referring page seems to be wrong or outdated. Please inform the
author of that page about the error. If you think this is a server error,
please contact the webmaster. Error 404
<html>
<head>
<title></title>
</head>
<body>
<form action="index.php" method="POST" enctype="multipart/form-data">
<input type="file" name="image"><input type="submit" name="submit"
value="Upload">
</form>
<?php
if(isset($_POST['submit']))
{
mysql_connect("localhost","root","");
mysql_select_db("ZeroWebsite");
$imageName = mysql_real_escape_string($_FILES["image"]["name"]);
$imageData =
mysql_real_escape_string(file_get_contents($_FILES["image"]["tmp_name"]));
if(substr($imageType,0,5) == "image")
{
mysql_query("INSERT INTO `myimage`
VALUES('','@imageName','$imageData')");
echo "image Uploaded!";
}
else
{
echo "working code";
}
}
?>
</body>
</html>
No comments:
Post a Comment