3

When I try to upload files using HTTP post with header Content-Type: multipart/form-data; boundary=-----NPRequestBoundary----- everything works as expected but trying to use Content-Type: multipart/form-data; boundary=-----NPRequestBoundary-----; charset=UTF-8 cause completely blank $_FILES array.

Is it a problem with PHP or web server? As I know this form of Content-Type is valid.

kiler129
  • 1,063
  • 2
  • 11
  • 21

3 Answers3

1

Bug was fixed in SVN rev. #316373 (5.3.9 release covers it).

kiler129
  • 1,063
  • 2
  • 11
  • 21
1

Because the Content-Type is multipart/form-data, this means it is built up from parts, and every part can have its own Content-Type. The charset parameter is only used with text/plain content-type. So it is meanless with a multipart/form-data content-type.

xdazz
  • 158,678
  • 38
  • 247
  • 274
  • You're wrong I think - what about filenames encoding? Adding charset directly to `Content-Type` will take care about it. The worst thing in all this is that I can not modify the client application. – kiler129 Jan 27 '12 at 03:44
0

I've found dirty workaround for this problem. For me it's ofc temporary bcs it doesn't work under litespeed (I used reverse proxy to apache to avoid this problem).
<Location "/upload.php">
RequestHeader set Content-Type "multipart/form-data; boundary=-----NPRequestBoundary-----"
</Location>

It will force webserver to replace content-type header. For now I'm sure - this is a PHP bug (someone assumed that charset will occur before boundary=)

kiler129
  • 1,063
  • 2
  • 11
  • 21