|
Posted by Jerry Stuckle on 02/26/07 11:59
Jørn Dahl-Stamnes wrote:
> Hello folks,
>
> I need some help/advice FAST.
>
> I have problems with addslashes on my web-servers. After uploading a file, I
> read the uploaded file, use addslashes on the read data and then insert it
> into a blob field in a MySQL database.
>
> The problem is that this works fine on my internal test web-server (running
> under RedHat 7.3). But on my production web-server (running Fedora Core 4)
> it "fails". The same function create different outputs on the two servers.
> The data on the prod server is corrupted.
>
> I added code to the upload script that dumps the data returned by addslashes
> to a file. I then compared this file created on the two servers (based on
> the same uploaded document). They are different both in content and length.
>
> Both servers use the same version of Apache, PHP and MySQL. The only
> difference is the OS.
>
> I use PHP ver 4.3.9, Apache ver 2.0.52 and MySQL ver 4.1.8
>
Well, first of all, you shouldn't be using addslashes. You should be
using mysql_real_escape_string(), especially since this is binary data.
And when you say the data is different - exactly what is different about
the two? There could be lots of things going on here, and without
knowing what's different, it's impossible to say.
For instance - once uploaded, are the files exactly the same (before you
do anything to them)?
Also, what charset is being used by MySQL?
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|