@@ -1582,17 +1582,37 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
1582
1582
* must be explicitly cast to long in curl_formadd
1583
1583
* use since curl needs a long not an int. */
1584
1584
if (* postval == '@' ) {
1585
+ char * type ;
1585
1586
++ postval ;
1587
+
1588
+ if ((type = php_memnstr (postval , ";type=" , sizeof (";type=" ) - 1 , postval + strlen (postval )))) {
1589
+ * type = '\0' ;
1590
+ }
1586
1591
/* safe_mode / open_basedir check */
1587
1592
if (php_check_open_basedir (postval TSRMLS_CC ) || (PG (safe_mode ) && !php_checkuid (postval , "rb+" , CHECKUID_CHECK_MODE_PARAM ))) {
1593
+ if (type ) {
1594
+ * type = ';' ;
1595
+ }
1588
1596
RETVAL_FALSE ;
1589
1597
return 1 ;
1590
1598
}
1591
- error = curl_formadd (& first , & last ,
1599
+ if (type ) {
1600
+ type ++ ;
1601
+ error = curl_formadd (& first , & last ,
1602
+ CURLFORM_COPYNAME , string_key ,
1603
+ CURLFORM_NAMELENGTH , (long )string_key_len - 1 ,
1604
+ CURLFORM_FILE , postval ,
1605
+ CURLFORM_CONTENTTYPE , type ,
1606
+ CURLFORM_END );
1607
+ * (type - 1 ) = ';' ;
1608
+ } else {
1609
+ error = curl_formadd (& first , & last ,
1592
1610
CURLFORM_COPYNAME , string_key ,
1593
1611
CURLFORM_NAMELENGTH , (long )string_key_len - 1 ,
1594
- CURLFORM_FILE , postval ,
1612
+ CURLFORM_FILE , postval ,
1595
1613
CURLFORM_END );
1614
+
1615
+ }
1596
1616
} else {
1597
1617
error = curl_formadd (& first , & last ,
1598
1618
CURLFORM_COPYNAME , string_key ,
0 commit comments