httpful
httpful copied to clipboard
Attach method postname
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));
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++
+1
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