So I'm getting a Pdf file send to my webservice for me to upload,
it's send to me as a base64Binary type variable,
and uploaded using below script :
mysql_query("INSERT INTO tablename (Filename, FileSize, File)
VALUES ( '" . $parameters['Filename'] . "', '". $parameters['FileSize'] . "', '" . $parameters['File'] . "' ) ") or die (mysql_error());
Now everything is getting uploaded, only the weird thing is, for instance if I upload an 370KB file, it's 490KB in the Database....
I don't know how this happens, and if this is normal?
Now to save it in my fileserver :
$query = mysql_query("SELECT File FROM tablename WHERE ID = '1' ") or die (mysql_error());
$fetch = mysql_fetch_array($query);
$data = $fetch;
When I open this file that is getting saved now in my fileserver, I get this error : "user_123.pdf cannot be opened because this filetype is not supported or because it is damaged."
I'm fairly new to Blob types, and I know that storing files on your server is sometimes better, but I have to use Blob times, since I was asked to do so.
If anyone could help me out here, it would be greatly appreciated.
Solved it, had to use base64_decode($data) on my blobtype.