• Luca Foss

    (@luca-foss)


    I’ve been doing research into this and I’m finding that many have had issues with the function wp_handle_upload(). One notable issue is that it would produce this error, but the file will be uploaded to the directory anyway…and the same thing happened with me. The avatar is uploaded to the directory, but I still get the error message. Any idea on what could be causing this and how to solve?

    I found notes on this piece of code in the file.php folder…it says that “A properly uploaded file will pass this test. There should be no reason to override this one.”

    if ( $test_upload && ! @ is_uploaded_file( $file['tmp_name'] ) )
    		return call_user_func($upload_error_handler, $file, __( 'Specified file failed upload test.' ));

    Not sure what would be considered an improper loaded file.

Viewing 9 replies - 1 through 9 (of 9 total)
  • i_banks

    (@i_banks)

    WOW….I’m having the same EXACT issue…lol…hopefully we can find a solution together…

    David Gard

    (@duck_boy)

    Try looking in to wp_sideload_handle(); – that works for me.

    Thread Starter Luca Foss

    (@luca-foss)

    @ duck_boy

    I haven’t seen that function before and I can’t find it in the codex…can you please provide a little more insight on it’s use?…

    David Gard

    (@duck_boy)

    That’ll be because I’m just making up random function names!

    media_handle_sideload(); – That’s what it is actually called!

    Thread Starter Luca Foss

    (@luca-foss)

    Okay…I saw this one in the codex earlier…I just made the changes and uploaded it to my files, and I get a “call to undefined function” error message…

    Is this being used in a newer version of WordPress? right now I’m using 3.0.2..

    David Gard

    (@duck_boy)

    Yeah – was on 3.0.2 when I started using it, and it’s still good on 3.1.

    This is how I use it in my code – you may have to also include these files –

    include_once($_SERVER['DOCUMENT_ROOT'].'wp-admin/includes/media.php');
    include_once($_SERVER['DOCUMENT_ROOT'].'wp-admin/includes/file.php');
    include_once($_SERVER['DOCUMENT_ROOT'].'wp-admin/includes/image.php');
    $attached_id = media_handle_sideload($aFile, $post_id, $_POST['file_name']);

    Thread Starter Luca Foss

    (@luca-foss)

    alright..appreciate it…this gives me a starting point…

    If you can, I would appreciate it if you could check back on this thread over the next few days (or whenever you get the time), because I’ve have a couple of questions for you about this function ( media_handle_sideload ) that I observed in the codex before I began this post.

    I did some research online and I want to share that with you as well..I have to head out to work…thanks…

    David Gard

    (@duck_boy)

    Any news on this one? Hope the media_handle_sideload(); function did the trick for you.

    I’d love some info on media_handle_sideload too! Any feedback?

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Getting Error Message with wp_handle_upload()…PLEASE HELP..’ is closed to new replies.