WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] The uploaded file could not be moved to ... This is different then the others. (2 posts)

  1. ricbax
    Member
    Posted 4 years ago #

    I am getting the infamous "The uploaded file could not be moved to (path to uploads goes here) "

    I have added the following php function to the class-wp-upgrader.php to get the output that is getting generated.

    print_r($_FILES);

    //Handle a newly uploaded file, Else assume its already been uploaded
                    if ( !empty($_FILES) ) {
                            $this->filename = wp_unique_filename( $uploads['basedir'], $this->filename );
                            $this->package = $uploads['basedir'] . '/' . $this->filename;
      here ----- >   print_r($_FILES);
                            // Move the file to the uploads dir
                            if ( false === @ move_uploaded_file( $_FILES[$form]['tmp_name'], $this->package) )
                            wp_die( sprintf( __('The uploaded file could not be moved to %s.' ), $uploads['path']));
                    } else {
                            $this->package = $uploads['basedir'] . '/' . $this->filename;
                    }

    This is the output I get when uploading a new plugin (Install Plugin):

    Array ( [pluginzip] => Array ( [name] => core-control.0.8.zip [type] => application/x-zip-compressed [tmp_name] => /tmp/phpTPbYjk [error] => 0 [size] => 167862 ) )

    Installing Plugin from uploaded file: core-control.0.8.zip
    Unpacking the package.
    Installing the plugin.
    Plugin Installed successfully.
    Actions: Activate Plugin | Return to Plugins page
    This is the output I get when uploading a new theme (Install Themes)

    Array ( [themezip] => Array ( [name] => typebased.zip [type] => [tmp_name] => [error] => 1 [size] => 0 ) )

    The uploaded file could not be moved to (path to uploads goes here) "

    I am positive it is not a permissions issue since plugins and themes both use the uploads folder. The $_FILES array is not getting populated during the upload process. I think there is a bug?

    -ricbax

  2. ricbax
    Member
    Posted 4 years ago #

    Just in case anyone else has this issue:

    http://www.php.net/manual/en/features.file-upload.errors.php

    [tmp_name] => [error] => 1

    UPLOAD_ERR_INI_SIZE

    Value: 1; The uploaded file exceeds the upload_max_filesize directive in php.ini.

Topic Closed

This topic has been closed to new replies.

About this Topic