Re: problems with writing picture to the database.

From: Date: Tue, 13 Feb 2001 11:01:20 +0000
Subject: Re: problems with writing picture to the database.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-39396@lists.php.net to get a copy of this message
O.K. I still got the problems. I`ll paste everything needed here and please, if anyone knows how to make it work, let me know. *First, the part of the form is the following: <INPUT TYPE="file" NAME="file"> the enctype in my form tag is ENCTYPE="multipart/form-data" and METHOD = POST *The code that actually *should* take care of the upload process to mysql, is the following: if (isset($file) AND $file != "none" AND strlen($file)>2){ $file_data = fread( fopen($file, 'r'), filesize($file) ); $theq = "INSERT INTO pildid (file_name,file_type,file_data,tyyp,subid,picnr) VALUES ('$file', '$file_type', '".addslashes($file_data)."','travels','$it','0')"; $result = mysql_query($theq); } And the errors I get, are': Warning: fopen("C:\\ajutine\\Kevad.jpg","r") - No such file or directory in /home/einfeldt/public_html/bt2/reis.php3 on line 62 Warning: Supplied argument is not a valid File-Handle resource in /home/einfeldt/public_html/bt2/reis.php3 on line 62 INSERT INTO pildid (file_name,file_type,file_data,tyyp,subid,picnr) VALUES ('C:\\ajutine\\Kevad.jpg', '', '','travels','9','0') Thanks Siim Einfeldt

« previous php.general (#39396) next »