473,835 Members | 1,718 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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)(Charact er
#10)(Binary data)

My PHP script looks like this:

<?
include('databa sedef.php');
set_magic_quote s_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($handl e,20);

$picture=mysql_ real_escape_str ing(fread($hand le,$c));

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

fclose($handle) ;
mysql_close($ch andle);
?>

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 1469
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
3357
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 Explicit and Response.Expires=-1,
0
1142
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. Request.Form returns no values. I have been over and over examples and have attempted to break my code down to nothing. As of right now, I'm using the example just how I found it, and still am having no luck. I'm using the .net framework v1.1....
3
5269
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 controls, requiredfieldvalidator controls which validate the textboxes, and a linkbutton control that postbacks the web page. The problem is, when the user clicks on the linkbutton control on one user control, the requiredfieldvalidator gets...
1
1058
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. I have the following: Private Sub frmMainMenu_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
37
3390
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
2460
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 everything I could think of. Here is my entire HTML code:
10
1299
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), _ Category("Behavior"), _
1
1847
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 do the conversion I only fill the Tags names ... Then I use a join to find these tags into my database.Tags and get their ID's.
1
2676
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", "Joe@email.com", null, null, true, null, out status); if (user != null) { ProfileHelper profile =
0
9810
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9653
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10526
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10563
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10237
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7770
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6970
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4435
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3094
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.