curl-and-php
Re: Set content-type for http post upload file not possible
Date: Wed, 12 Dec 2007 23:40:33 +0100 (CET)
On Wed, 12 Dec 2007, Morgan Galpin wrote:
> If the end of the filename matches one of the extensions, then it will
> insert the associated mime type for the "Content-type:". If it isn't one of
> the 5, then the mime type is "application/octet-stream". These 6 types are
> hard-coded into cURL. There is no way to change the set of mime types
> without modifying the source code and recompiling it. :-( It should read
> some kind of mime.magic file instead.
No it shouldn't. It provides a way for the application to set whatever type it
pleases, and that's the way apps should set a preferred type.
> If either the PHP-curl interface or cURL code were changed to accommodate
> this kind of upload, I could get my application to work.
libcurl offers this feature and as you say the command line tool works fine
and can change it.
PHP/CURL's formpost support is weird and someone should fix that properly and
while doing that they could also make sure that changing the content-type gets
supported. Just cramming in content-type support without fixing the whole mess
will only make it even messier.
-- Commercial curl and libcurl Technical Support: http://haxx.se/curl.html _______________________________________________ http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-phpReceived on 2007-12-12