mirror of
https://github.com/php/php-src.git
synced 2025-08-19 08:49:28 +02:00
Fixed bug #48962 (cURL does not upload files with specified filename).
This commit is contained in:
parent
ec97c3c3e3
commit
82aeae4da1
1 changed files with 14 additions and 14 deletions
|
@ -1863,32 +1863,32 @@ type_conflict:
|
||||||
* must be explicitly cast to long in curl_formadd
|
* must be explicitly cast to long in curl_formadd
|
||||||
* use since curl needs a long not an int. */
|
* use since curl needs a long not an int. */
|
||||||
if (*postval == '@') {
|
if (*postval == '@') {
|
||||||
char *type;
|
char *type, *filename;
|
||||||
++postval;
|
++postval;
|
||||||
|
|
||||||
if ((type = php_memnstr(postval, ";type=", sizeof(";type=") - 1, postval + Z_STRLEN_PP(current)))) {
|
if ((type = php_memnstr(postval, ";type=", sizeof(";type=") - 1, postval + Z_STRLEN_PP(current)))) {
|
||||||
*type = '\0';
|
*type = '\0';
|
||||||
}
|
}
|
||||||
|
if ((filename = php_memnstr(postval, ";filename=", sizeof(";filename=") - 1, postval + Z_STRLEN_PP(current)))) {
|
||||||
|
*filename = '\0';
|
||||||
|
}
|
||||||
/* open_basedir check */
|
/* open_basedir check */
|
||||||
if (php_check_open_basedir(postval TSRMLS_CC)) {
|
if (php_check_open_basedir(postval TSRMLS_CC)) {
|
||||||
RETVAL_FALSE;
|
RETVAL_FALSE;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
error = curl_formadd(&first, &last,
|
||||||
|
CURLFORM_COPYNAME, string_key,
|
||||||
|
CURLFORM_NAMELENGTH, (long)string_key_len - 1,
|
||||||
|
CURLFORM_FILENAME, filename ? filename : postval,
|
||||||
|
CURLFORM_CONTENTTYPE, type ? type + sizeof(";type=") - 1 : "application/octet-stream",
|
||||||
|
CURLFORM_FILE, postval,
|
||||||
|
CURLFORM_END);
|
||||||
if (type) {
|
if (type) {
|
||||||
error = curl_formadd(&first, &last,
|
|
||||||
CURLFORM_COPYNAME, key,
|
|
||||||
CURLFORM_NAMELENGTH, l,
|
|
||||||
CURLFORM_FILE, postval,
|
|
||||||
CURLFORM_CONTENTTYPE, type + sizeof(";type=") - 1,
|
|
||||||
CURLFORM_END);
|
|
||||||
*type = ';';
|
*type = ';';
|
||||||
} else {
|
}
|
||||||
error = curl_formadd(&first, &last,
|
if (filename) {
|
||||||
CURLFORM_COPYNAME, key,
|
*filename = ';';
|
||||||
CURLFORM_NAMELENGTH, l,
|
|
||||||
CURLFORM_FILE, postval,
|
|
||||||
CURLFORM_END);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
error = curl_formadd(&first, &last,
|
error = curl_formadd(&first, &last,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue