Jump to content

upload image not working


MDanz

Recommended Posts

form

<form action="<?php $_SERVER['PHP_SELF']; ?>" enctype="multipart/form-data" method="post" ><input type="file" name="photo" value="" size="30" /><input type="submit" name="ssubmit" value="Submit"  /></form>

 

$tmpname  = $_FILES['photo']['tmp_name']; 

$readphoto = fopen($tmpname, 'r'); 
$photo = fread($readphoto, filesize($tmpname));
$photo = addslashes($photo); 
fclose($readphoto); 


$query = "INSERT INTO student (PHOTO) ".
"VALUES ('$photo')";

mysql_query($query) or die('Error, query failed.');



echo "Student information submitted.";

 

 

i keep getting "Error, query failed"... what did i do wrong?

Link to comment
https://forums.phpfreaks.com/topic/223580-upload-image-not-working/
Share on other sites

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.