PHP MYSQL file contents escape problem -


I'm one. I am trying to upload a pdf file to a MySQL database using a php file.

All this is good except for the contents of the file. It is not a matter of particular that I try to avoid special characters, the query always fails, mostly with the "unknown command \ n".

I used the addlashes, mysql_real_escape_string, removeslashes, etc.

Do anyone have any idea to avoid file content?

Many thanks,

I have used the previously given sequence, Which works well, and stores any data in DB, which includes images, pdff, array of data etc.)

Storing data (a string, array , Objects, etc.);

(base64_encode (addslashes (gzcompress ($ datastostore), 9) '+ / =', '-_,');

Then store that string data in DB ...


Recovering Data;

Remove string data from db

Decode back the data you want (depending on input data, array, image etc.) you may need to take an additional step is).

$ ReturnData = unserialize (gzuncompress (straspels (base64_decode (strtr ($ strDataFromDb, '-_,', '+ / ='))));

This definitely helps me store the necessary things to store in my SQL DB!


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -