• I’m trying to set up a file upload in a plugin, but for some reason, wp_handle_upload always returns the following error:

    File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini or by post_max_size being defined as smaller than upload_max_filesize in php.ini.

    I checked post_max_size and upload_max_filesize and they are both set to 64M, much bigger than the files I’m trying to upload.

    Here is the code I’m using to handle the upload:

    $newpath = 'uploads';
    update_option('upload_path',$newpath);
    $overrides = array( 'test_form' => false);
    $cpnfile = wp_handle_upload($_FILES['cpnfile'], $overrides);
    print_r($cpnfile);

    Any help would be much appreciated, thanks!

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘wp_handle_upload always returns empty’ is closed to new replies.