hi all,
i'm uploading an image and saving it into a database as a blob using existing code that worked on another page.
code sample:
if ($adImage) {
$adImage=(addSlashes($adImage));
$data = mysql_escape_string(fread(fopen($adImage, "rb"), filesize($adImage)));
}
$db->query("UPDATE tbl SET adImage = '$data',filename = '$adImage_name',filesize = '$adImage_size',filetype = '$adImage_type' WHERE adID = $editID");
this code worked great on another page; and, if you notice, the variables adImage_type, adImage_size,adImage_name, I suppose, generated from the mysql_escape_string function? i don't know exactly, but it worked.
anyway, this page i tried to encapsulate this code into function savePhoto($photo,$edit,$uname) {
$photo=(addSlashes($photo));
$data = mysql_escape_string(fread(fopen($photo, "rb"), filesize($photo)));
if ($edit == 'yes') {
//this is where i checked to see if the vars were generated, they weren't
//echo $photo_name." ".$photo_size." ".$photo_type;
$db->query("UPDATE nuke_users SET photo = '$data',filename = '$photo_name',filesize = '$photo_size',filetype = '$photo_type' WHERE uname = '$uname'");
}else{
$db->query("INSERT INTO nuke_users (photo,filename,filesize,filetype) VALUES ('$data','$photo_name','$photo_size','$photo_type')");
}
}
at first, i thought my error was i didn't put ENCTYPE="multipart/form-data" in the form. but i corrected that and i STILL cannot get the photo information.
suggestions?
by the way, i am working with phpNuke, trying to mod the Your_Account index.php in case that matters