Jarmila -- ...and then Jarmila Kedr_tová said... % % I would like to know how to insert uploaded file(image) into database % (mysql) into Blob column type. As I upload the file, convert it into string % by using file_get_contents function, there are many aphostrophes in it and % inserting is not possible. Is there some way to solve this problem? For me
You could addslashes() the string, but why not just whip up a query using the mysql load_file() function? I haven't used it before, and I don't see immediately how to do it all in one call (because the mysql manual gives an UPDATE example), but surely creating the record first and getting the record number and then something like update tbl set col = load_file("/path/to/file") where id = recno ; would work. % is unacceptable to organize images into filesystem because application which % I programme expect uploading of huge amount of images and pictures, % organised by persons, themas and so on, where is using database organized % tables and hierarchy the best way. Thanks for your answer. I hear this sort of thing a lot, and I'm still not sold on the requirement of having the files inside the database. Oh, I agree that you should let the database handle the organization, but that has nothing to do with storing the files in the filesystem. Whether you have one big directory or a whole tree structure, whether you assign a filename based on record number or store the path and file name or even just use raw inod numbers, doesn't matter; no matter how you slice it you end up with a pointer to the data. And it seems a lot simpler to store the data in a file, and a lot faster to query the db without having to go over the image data every time, and in general just better to use the filesystem (which, after all, is a sort of database anyway :-) % Jarmila Kedrstova HTH & HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, "Science and Health" http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
pgp00000.pgp
Description: PGP signature