ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> php-dev
php-dev
#46696 [NEW]: cURL fails in upload files with specified content-type
by Marceloburegio At Gmail Dot Com other posts by this author
Nov 27 2008 5:06AM messages near this date
#46697 [Opn->Csd]: fread() fails for non-buffered streams in ssh2 | #46696 [Opn->Csd]: cURL fails in upload files with specified content-type
From:             marceloburegio at gmail dot com
Operating system: Linux and Windows
PHP version:      5.2.6
PHP Bug Type:     cURL related
Bug description:  cURL fails in upload files with specified content-type

Description:
------------
Using the cURL to send files with the Content-Type different of set in
cURL (Eg.: "@filename;type=content-type"), PHP reads entire string after
the @ and tries to find the file, that does not exists because of
";type=".

Running an I/O monitor, verified that PHP tries to find the file
"filename;type=content-type" (defined after @), which in fact does not
exist.

Probably the problem is in interface.c, in line 1484, where the string
wasn't separated in filename and content-type.

The above procedure was followed the response of the bug reported in
#41610, the manual of cURL in http://curl.haxx.se/docs/manual.html, in
addition to comments of this issue in http://curl.haxx.
se/mail/curlphp-2007-12/0033.html


Reproduce code:
---------------
# File test.php
-----------------
$data = array('file' =>  '@sheet.xls;type=application/vnd.ms-excel');

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://localhost/upload.php');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_exec($ch);

echo curl_error($ch);


# File upload.php
-------------------
print_r($_FILES);


Expected result:
----------------
# Response of test.php
------------------------
Array
(
    [file] =>  Array
        (
            [name] =>  sheet.xls
            [type] =>  application/vnd.ms-excel
            [tmp_name] =>  /tmp/php2B8.tmp
            [error] =>  0
            [size] =>  13824
        )
)


Actual result:
--------------
# Response of test.php
------------------------
failed creating formpost data


-- 
Edit bug report at http://bugs.php.net/?id=46696&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        http://bugs.php.net/fix.php?id=46696&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        http://bugs.php.net/fix.php?id=46696&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        http://bugs.php.net/fix.php?id=46696&r=trysnapshot60
Fixed in CVS:                        http://bugs.php.net/fix.php?id=46696&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=46696&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=46696&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=46696&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=46696&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=46696&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=46696&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=46696&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=46696&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=46696&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=46696&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=46696&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=46696&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=46696&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=46696&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=46696&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=46696&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=46696&r=mysqlcfg
Thread:
Marceloburegio At Gmail Dot Com
iliaa

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved