|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You don't need a fax machine to get faxes. Get a fax-to-email fax number from CallWave. Try it free.
|
|
#1
|
|||
|
|||
|
Upload image file to MySQL as BLOB
hello,
i have this code below in which to upload image and store if in the database but it occurs an error upon running the program please help me im stack in here .. thankss PHP Code:
errors: Warning:fopen: failed to open stream: No such file or directory in Warning: feof(): supplied argument is not a valid stream resource in on line 26 |
|
#2
|
||||
|
||||
|
To upload a file through a form in a browser, the enctype must be -
Code:
enctype="multipart/form-data" Reading this link will probably help - http://www.php.net/manual/en/features.file-upload.php |
|
#3
|
|||
|
|||
|
cwf is right eyeshield21 and i haven't tried storing an IMAGE exactly in a database.. an easy way for me is that i store only the FILENAME of the FILE/IMAGE into the database.. i'm not sure if you're comfortable using this type of style but that's how I did it..
but we all know that there are so many ways of managing a FILE.. More reference: http://www.php.net/features.file-upload http://www.tizag.com/phpT/fileupload.php http://www.w3schools.com/php/php_file_upload.asp |
|
#4
|
||||
|
||||
|
Since the subject of storing images/files in a database has been brought up... my 2 cents -
A database is not a file storage engine. Using a database to store files is inefficient. It takes more processing CPU cycles, more memory, more time, and more storage space over just storing the files as a file. Because binary data must be escaped before putting it into the database and un-escaped every time it is retrieved, the PHP program and the database engine use up additional resources over what is needed to just keep the file as a file in the file system. I just did a quick test of the additional disk space need. It was about 2%-3% for the two test files I used - Original .jpg file - 121,040 escaped size - 123,936 a 2.4% increase. Original .jpg file - 57,902 escaped size - 59,577 a 2.9% increase. If you have a lot of files or the file sizes are large, this extra storage space will add up. |
|
#5
|
|||
|
|||
|
The only reason to store file contents is if you absolutely need the security model that the database provides. If you were for instance storing image scans of patient x-ray examinations or other private medical information in pdf form, then it might be necessary to store them in the database, otherwise, it's just a performance and storage problem, that you aren't going to want to deal with.
|
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Applications > Upload image file to MySQL as BLOB |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|
|