PHP Uploading issue in wordpress, Getting Error 0 but image is not uploaded to my folder

Solution:1

Here’s a Self Debug Way

There are mainly 2 reason for this error. At this time you shall look the following steps to fix it by yourself.

  1. Make sure that you have enough permission to upload the image for your folder /uploads

Note : You can have 755 permission

  1. Make sure that the table wp_options has the value for upload_path as wp-content/uploads in it. (If not update it)

Note : You can also update it at Settings>Media

Solution:2

As I am using wordpress, I found this code from one of a wordpress page

the code is as follows:

    if ( ! function_exists( 'wp_handle_upload' ) ) {
        require_once( ABSPATH . 'wp-admin/includes/file.php' );
    }

    $uploadedfile = $_FILES['resume'];

    $upload_overrides = array( 'test_form' => false );

    $movefile = wp_handle_upload( $uploadedfile, $upload_overrides );

    if ( $movefile && !isset( $movefile['error'] ) ) {
        echo "File is valid, and was successfully uploaded.\n";
        //var_dump( $movefile); 
        //If you want to see details of your uploaded file uncomment the above line
    } else {
        /**
         * Error generated by _wp_handle_upload()
         * @see _wp_handle_upload() in wp-admin/includes/file.php
         */
        echo $movefile['error'];
    }

do not remove this “$upload_overrides = array( ‘test_form’ => false );” from above code, as it will not work.