Upload::save_uploads()

Description #

Save all uploads to server.

Source #

File: lib/form/class-upload.php

329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
public function save_uploads() {
    if ( $this->have_errors() || true === $this->uploaded ) {
        return;
    }
 
    $value = $this->value();
 
    // Return if value is empty.
    if ( empty( $value ) ) {
        return;
    }
 
    if ( $this->get( 'upload_options.multiple', false ) ) {
        foreach ( (array) $value as $file ) {
            $this->upload_file( $file );
        }
    } else {
        $this->upload_file( $value );
    }
 
    $this->value    = $this->uploaded_files;
    $this->uploaded = true;
}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment