php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14320 multipart form posts can't upload files anymore
Submitted: 2001-12-03 03:50 UTC Modified: 2001-12-03 04:28 UTC
From: daniel at haxx dot se Assigned:
Status: Closed Package: cURL related
PHP Version: 4.1.0 OS: any
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: daniel at haxx dot se
New email:
PHP Version: OS:

 

 [2001-12-03 03:50 UTC] daniel at haxx dot se
Using the CURL module in previous versions of PHP you could upload a file in a HTTP multipart formpost in a script like this:

     $ch = curl_init($APP);  
     curl_setopt($ch, CURLOPT_POSTFIELDS, array
('sampfile'=>"@$sampfile"));
     $postResult = curl_exec($ch);
     curl_close($ch);

With 4.1.0 (and what's currently in CVS), the CURL module has been modified to use the more proper libcurl function to deal with formposts, but it has the side-effect that pre-pending a file name with @ no longer works.

This is something that needs to be checked for and addressed in the ext/curl/curl.c source code if the above functionality is still wanted.

The functionality with a @-prepended file name is not documented anywhere in the PHP curl documentation AFAIK, but there are users out there that have found about this feature (it is a standard curl way of doing it using the command line) so there might be a point to continue supporting this.

(I am the libcurl maintainer, this report is based solely on source code auditing, I have not ran any PHP code to find out.)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-12-03 04:28 UTC] sterling@php.net
Fixed in CVS (and PHP 4.0.1 branch) -- thanks.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu May 08 00:01:29 2025 UTC