httpful icon indicating copy to clipboard operation
httpful copied to clipboard

Attach method postname

Open Crofly opened this issue 10 years ago • 3 comments

In the attach method the postname in curl_file_create is not set. This can make problems with APIs which uses this parameter. For Example in an API which i have to call the file i send will have the full Path as name because the postname isnt set.

An easy fix for this would be changing this:

if (function_exists('curl_file_create')) {
    $this->payload[$key] = curl_file_create($file, $mimeType);
} 

To this:

if (function_exists('curl_file_create')) {
    $this->payload[$key] = curl_file_create($file, $mimeType, basename($file));
} 

Crofly avatar Oct 27 '15 16:10 Crofly

++++++++++++++++++++++++++++++++++++++++++++++++++++++

vstaikov avatar Mar 27 '17 20:03 vstaikov

+1

MisterDuval avatar Nov 16 '17 14:11 MisterDuval

There is also a security problem. The file with the absolute path is always transferred! This can be a information disclosure on file post for the server. We fixed this and started a pull request #278

theroch avatar Sep 07 '18 15:09 theroch