I'm trying to upload images and store them in a table, my code is:
//
$theFile=fopen($adlink,"rb");
$imdata=addslashes(fread($theFile,filesize($adlink)));
fclose($theFile);
mysql_query("insert into addons values (-1,'$descr',$atype,'$imdata')",$link);
//
$adlink is the name of my <input type=file> field in the form, I try to upload a simple jpg image and the problem I get is in the first line of the code:
Warning: fopen("C:\Documents and Settings\angelef1\My Documents\DynaProc\backsearch2.jpg","rb") - No such file or directory in /usr/local/apache/htdocs/areas/psca/mechanic/hotlist/addons.php on line 27
Warning: Supplied argument is not a valid File-Handle resource in /usr/local/apache/htdocs/areas/psca/mechanic/hotlist/addons.php on line 28
Warning: Supplied argument is not a valid File-Handle resource in /usr/local/apache/htdocs/areas/psca/mechanic/hotlist/addons.php on line 29
I guess fopen() cannot find the file, but why??
What am I doing wrong?
I would really appreciate your help, I need to get this done by Friday!