Title: Error when saving content with ACF file fields
Last modified: July 19, 2020

---

# Error when saving content with ACF file fields

 *  Resolved [tomekw8](https://wordpress.org/support/users/tomekw8/)
 * (@tomekw8)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/error-when-saving-content-with-acf-file-fields/)
 * Hello,
 * I use custom fields created with Advanced Custom Fields. Some of them are file(
   upload) fields placed in repeater field.
    When user with limited capabilities
   role (e.g. Contributor) tries to save the post warning appears and file(s) are
   not being uploaded:
 * `Warning: is_file() expects parameter 1 to be a valid path, array given in /wp-
   content/plugins/wp-cerber/cerber-load.php on 6936`
 * I did some debugging and var_dump($files) shows this structure:
 *     ```
       array (size=2)
         'field_568a1dd843f06' => string '' (length=0)
         'field_568c535b182f4' => 
           array (size=2)
             'row-0' => 
               array (size=1)
                 'field_568c5387182f5' => string '' (length=0)
             'row-1' => 
               array (size=1)
                 'field_568c5387182f5' => string '(...)' (length=25)
       ```
   
 * And this is my fix proposal (line 6923):
 *     ```
       foreach ( $_FILES as $file ) {
           if ( is_array( $file['tmp_name'] ) ) {
               foreach ( $file['tmp_name'] as $file_temp_name ){
                   if( is_array( $file_temp_name ) ){
                       $files = array_merge( $files, array_map( 'array_shift', $file_temp_name ) );
                   } else {
                       $files[] = $file_temp_name;
                   }
               }
           }
           else {
               $files[] = $file['tmp_name'];
           }
       }
       ```
   
 * Best regards,
    Tomek

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [gioni](https://wordpress.org/support/users/gioni/)
 * (@gioni)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/error-when-saving-content-with-acf-file-fields/#post-13143776)
 * Thank you Tomek for telling me! I’ll look into it soon.
 *  Plugin Author [gioni](https://wordpress.org/support/users/gioni/)
 * (@gioni)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/error-when-saving-content-with-acf-file-fields/#post-13772733)
 * It’s been improved in the last version. Please test it out.
 *  Thread Starter [tomekw8](https://wordpress.org/support/users/tomekw8/)
 * (@tomekw8)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/error-when-saving-content-with-acf-file-fields/#post-13779239)
 * I can confirm, the issue has been resolved. Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Error when saving content with ACF file fields’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-cerber_77a9bf.svg)
 * [WP Cerber Security, Anti-spam & Malware Scan](https://wordpress.org/plugins/wp-cerber/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-cerber/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-cerber/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-cerber/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-cerber/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-cerber/reviews/)

## Tags

 * [ACF](https://wordpress.org/support/topic-tag/acf/)

 * 3 replies
 * 2 participants
 * Last reply from: [tomekw8](https://wordpress.org/support/users/tomekw8/)
 * Last activity: [5 years, 6 months ago](https://wordpress.org/support/topic/error-when-saving-content-with-acf-file-fields/#post-13779239)
 * Status: resolved