ID: 11516
Updated by: sniper
Old-Status: Open
Status: Feedback
Bug Type: Variables related
Operating system: 
PHP Version: 4.0.5
Assigned To: 

This works for me just fine. Could you please try
the latest snapshot from

Previous Comments:

[2001-06-16 19:37:27] [EMAIL PROTECTED]

first of all, I'm not 100% sure this is a bug, but I think it is. anyway, here goes:

I manually connect to a php script, by simulating a browser's call. I want to sent 
some data by simulating a multipart/form-data POST. The data I sent is binary, but 
since I want to put this data directly into a database, I don't want to use the 
Content-Disposition: form-data; name="whatever"; filename="C:whatever.exe" header.

This header would cause php to create a file in the tmp dir, and I don't want this. I 
simply want the binary data I send in a variable.

What I did was to set the following header: Content-Disposition: form-data; 
(without the filename="C:whatever.exe" part). After that I sent the binary data.

This should create a variable $whatever on the server. 
Everything works just fine until my binary data contains a NULL [chr(0)]. What happens 
is that php creates the variable $whatever, but truncates everything after the NULL 
character (including the NULL character itself).

Of course you wouldn't be able to send a NULL from a normal multipart form input box 
or textarea on the web, but I think php should be able to create a variable which 
contains my NULL character and everything that follows when I manually connect. It 
correctly creates a file (including the NULL) when I sent the 'filename="whatever"' 

By the way, if my form contains more parts after the binary part with the NULL 
character, php creates those variables correctly... but it just truncates everything 
after a NULL when I don't send something like filename="c:whatever.exe".

here is a copy of the headers I manually sent:
POST /script.php HTTP/1.1
Content-Type: multipart/form-data; boundary=---------------------------7d12b732260086
Content-Length: [The correct length]

Content-Disposition: form-data; name="whatever"

Content-Disposition: form-data; name="foo"

normal text, not binary

my script on the server now has 2 variables; $whatever and $foo.
print $foo; #this prints "normal text, not binary"
print $whatever; #this prints "123". it should have printed "123 456" (the space here 
simulating the unprintable NULL character)

I hope this all makes sense (I'm not sure it does :) ). But please email me if this 
message is not completely clear.

I hope you get back to me.

thanks in advance


ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at

PHP Development Mailing List <>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to