RE: [PHP] problems with writing picture to the database.
| From: | PHPBeginner.com | Date: | Tue, 13 Feb 2001 14:34:18 +0000 |
| Subject: | RE: [PHP] problems with writing picture to the database. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-39425@lists.php.net to get a copy of this message | ||
I am not sure on how to help you with this out,
this is because I've never done so before. Why would you put files inside a
database. Just copy them in some folder and name within a logic, inserting
only a small string in your DB or even without it. Then call the graphic.
This is easier, faster, reliable, extendable.
All these different databases support files to simply not to lose the war
with their competitors. Not much programmers use it.
Sincerely,
Maxim Maletsky
Founder, Chief Developer
PHPBeginner.com (Where PHP Begins)
maxim@phpbeginner.com
www.phpbeginner.com
-----Original Message-----
From: Siim Einfeldt aka Itpunk [mailto:siim_e@pshg.edu.ee]
Sent: Tuesday, February 13, 2001 8:01 PM
Cc: php-general@lists.php.net; php_uk@yahoogroups.com
Subject: Re: [PHP] problems with writing picture to the database.
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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net