ID:               49943
 User updated by:  p dot watras at gmail dot com
 Reported By:      p dot watras at gmail dot com
 Status:           Bogus
 Bug Type:         cURL related
 Operating System: FreeBSD 7.1
 PHP Version:      5.2.11
 New Comment:

The problem was described in #48962 which is marked as CLOSED. On the
other hand there already is a WORKING solution.

Anyway, I will search more thoroughly in future :)


Previous Comments:
------------------------------------------------------------------------

[2009-10-21 13:35:57] j...@php.net

Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

See bug #49921 and search before submit next time..

------------------------------------------------------------------------

[2009-10-21 12:56:24] p dot watras at gmail dot com

Description:
------------
This bug is similar to http://bugs.php.net/bug.php?id=48962.
As alexei suggested you have to manually edit interface.c in line
1593:
and change it to:
CURLFORM_FILENAME, filename ? filename+sizeof(";filename=") - 1 :
postval

Everything works fine after this update.



Reproduce code:
---------------
# File test1.php

$data = array('file' => '@/tmp/myfile;filename=foobar');

$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 test2.php

$data = array('file' =>
'@/tmp/myfile;filename=foobar;type=application/zip');

$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:
----------------
# Result of test1.php

Array
(
    [item_file] => Array
        (
            [name] => foobar
            [type] => application/octet-stream
            [tmp_name] => /var/tmp/phpCEVFto
            [error] => 0
            [size] => 36257
        )

)

# Result of test1.php

Array
(
    [item_file] => Array
        (
            [name] => foobar
            [type] => application/zip
            [tmp_name] => /var/tmp/phpCEVFto
            [error] => 0
            [size] => 36257
        )

)



Actual result:
--------------
Upload fails. No files are uploaded.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=49943&edit=1

Reply via email to