Title: Please update CURL upload code.
Last modified: February 2, 2018

---

# Please update CURL upload code.

 *  [changwoo](https://wordpress.org/support/users/changwoo/)
 * (@changwoo)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/please-update-curl-upload-code/)
 * My server runs on PHP 7.0, and I found that the plugin cannot attach uploaded
   files uploaded by cURL, or JS method via administration form.
 * I checked “Use PHP uploader. Need PHP Curl.” in the Additional Settings because
   default uploader also does not work.
 * I looked over your code and I have found that when the code attaches an uploaded
   file, it uses ‘@’ . filename. But this method may not work PHP5.6+ because it
   requires curl_setopt($ch, CURLOPT_SAFE_UPLOAD, false). Moreover, it is disabled
   as of PHP7.0+.
 * Therefore, switch code should be required. like:
 *     ```
       if (function_exists('curl_file_create')) { // php 5.5+
         $cFile = curl_file_create($file_name_with_full_path);
       } else { // 
         $cFile = '@' . realpath($file_name_with_full_path);
       }
       ```
   
 * ( [https://stackoverflow.com/questions/15200632/how-to-upload-file-using-curl-with-php](https://stackoverflow.com/questions/15200632/how-to-upload-file-using-curl-with-php))
 * I changed ‘includes/uaf_font_upload_php.php’ line 32 like below and fixed the
   upload problem. Please update and fix it.
 *     ```
       // includes/uaf_font_upload_php.php': 32
       // from
       'fontfile'           => "@".$_FILES['font_file']['tmp_name'],
       // to 
        'fontfile'           => (function_exists('curl_file_create') ?  curl_file_create($_FILES['font_file']['tmp_name']) : "@".$_FILES['font_file']['tmp_name']),
       ```
   
    -  This topic was modified 8 years, 4 months ago by [changwoo](https://wordpress.org/support/users/changwoo/).
      Reason: removed help url
    -  This topic was modified 8 years, 4 months ago by [changwoo](https://wordpress.org/support/users/changwoo/).
      Reason: code syntax fixed

The topic ‘Please update CURL upload code.’ is closed to new replies.

 * ![](https://ps.w.org/use-any-font/assets/icon-128x128.png?rev=2460363)
 * [Use Any Font | Custom Font Uploader](https://wordpress.org/plugins/use-any-font/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/use-any-font/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/use-any-font/)
 * [Active Topics](https://wordpress.org/support/plugin/use-any-font/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/use-any-font/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/use-any-font/reviews/)

## Tags

 * [curl](https://wordpress.org/support/topic-tag/curl/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * 0 replies
 * 1 participant
 * Last reply from: [changwoo](https://wordpress.org/support/users/changwoo/)
 * Last activity: [8 years, 4 months ago](https://wordpress.org/support/topic/please-update-curl-upload-code/)
 * Status: not resolved