Reply to Re: Trying to submit multipart/form-data HTTP POST using PHP script

Your name:

Reply:


Posted by Tim Roberts on 01/16/07 20:09

"Boldgeek" <ap@mardona.com> wrote:

>I am trying to develop an app that will allow automatic updating of a
>web form which uses multipart/form-data enctype (as it MIGHT be sending
>an image)
>
>I have an example form, which when submitted displays the results as
>you would expect.
>However when I send the same data using the PHP script I get a 400
>error:
>
>Bad Request
>Your browser sent a request that this server could not understand.
>Request header field is missing colon separator.
>( it then displays the boundary string.)
>
>After examining the HTTP headers for the submitted form, it appears
>EXACTLY the same as the post I make via the PHP script. I've tried
>copying EVERYTHING exactly and it still comes up with the error.
>
>If I remove the actual content, ie end the request like:
>
>Content-Type: multipart/form-data;
>boundary=---------------------------265001916915724
>Content-Length: 0

Is the "boundary" parameter on the same line as the Content-Type, or at
least indented on the next line?

>It works fine. However as soon as we start adding boundary strings and
>form parts, I get the error. Everything is formatted correctly. I can
>provide examples if required.
>
>I'm using fsockopen in the PHP script to connect to the target server &
>page
>
>I'm at my wits end trying to see what is wrong with the PHP script -
>anyone got any ideas?

You haven't given us enough information to know what the problem is. Here's
an example of a correct POST:

POST /cgi-bin/xxxx HTTP/1.0
Content-Type: multipart/form-data; boundary=----xxxx----

------xxxx----
Content-Disposition: form-data; name="myname"

Tim Roberts
------xxxx----
Content-Disposition: form-data; name="email"

timr@nonono.com

Is that what you are sending?
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация