473,231 Members | 1,435 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,231 software developers and data experts.

Going crazy about binary post

Hey all,

I'm tearing my hair out over this one.. I'm using EasyPHP, and trying to
write a script which receives binary POST data from a client program of
mine. I've put together a simplified example which demonstrates the
problem. The data looks like this:

(String showing the length of the following binary)(Character
#10)(Binary data)

My PHP script looks like this:

<?
include('databasedef.php');
set_magic_quotes_runtime(0);
$chandle = mysql_pconnect($servername, $username, $password) or
die("FAIL");
mysql_select_db($database, $chandle) or die ("FAIL");

$handle=fopen("php://input","rb") or die("FAIL");

$c=fgets($handle,20);

$picture=mysql_real_escape_string(fread($handle,$c ));

$query="INSERT INTO ".$table." (Picture) VALUES ('".$picture."')";
mysql_db_query($database, $query) or die("Failed Query");

fclose($handle);
mysql_close($chandle);
?>

Although I get the right number of bytes in my MySQL database, they're
corrupted! What setting am I missing here? The files being stored are
less than 40k in a MEDIUMBLOB field.

Cheers,
Nicholas Sherlock
Jul 17 '05 #1
2 1448
Puzzling. It might have something to do with the
encoding. What kind of files are you inserting?

More likely, though, it is a bug specific to
EasyPHP, perhaps due to compilation issues.
Can you try running your code on a Linux box?

Felix

Jul 17 '05 #2
Felix wrote:
Puzzling. It might have something to do with the
encoding. What kind of files are you inserting?
GIF images. It's got me beat as well.
More likely, though, it is a bug specific to
EasyPHP, perhaps due to compilation issues.
Can you try running your code on a Linux box?


I don't have one available.. I'll try updating the individual components
of EasyPHP.

Cheers,
Nicholas Sherlock
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: doltharz | last post by:
Please Help me i'm doing something i though was to be REALLY EASY but it drives me crazy The complete code is at the end of the email (i mean newsgroup article), i always use Option...
0
by: Jay Douglas | last post by:
I am trying to do an HTTP POST to a webpage from a DLL. The webpage is easily called, and a response is given. However, the web page is not receiving the POSTed variables. None of them. ...
3
by: Navin | last post by:
Hello friends... On a single asp.net web page i have a single server-side form that contains a couple of user-controls. Each user control has its own functionality and contains server-side textbox...
1
by: Merlin | last post by:
Hi Again Group, Sorry to trouble you all again but i`ve been looking at this problem for 2 weeks now and just don`t seem to be able to grasp how to create a relationship in VB.NET with ADO.NET....
37
by: Zhiv Kurilka | last post by:
Hi, I have a text file with following content: "((^)|(.* +))" if I read it with: k=System.IO.StreamReader( "file.txt",System.Text.Encoding.ASCII); k.readtotheend()
11
by: shapper | last post by:
Hello, I am creating a centered web site with various div's inside the main (pBase) div. Somehow, I am getting a gap on the top of my browser window both in IE and Firefox. I tried...
10
by: shapper | last post by:
Hello, I have a custom control under namespace MyNameSpace.WebControls with a property of type validation: ' Validation Private _Validation As Validation < _ Bindable(True), _...
1
by: shapper | last post by:
Hi, On a form I have an input where tags are inserted in a CSV format. Then on my code I convert the CSV string to a List<Tag>. Tag is an object with two properties: TagID and Name So when I...
1
by: shapper | last post by:
Hello, On my CMS I am signed as administrator and I am creating a Membership user and its profile: MembershipCreateStatus status; MembershipUser user = Membership.CreateUser("Joe", "Pass",...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.