WordPress.org

Ready to get started?Download WordPress

Forums

wp_handle_upload acts different on windows and *nix ? (1 post)

  1. jaro_aut
    Member
    Posted 7 years ago #

    I'm developing the WP-YAPB-Plugin which allows file uploads over the standard article-post-form. To get and save the sent file it uses the WP function wp_handle_upload to be found in admin-functions.php.

    The problem:

    It seems to me that the method acts differently on windows (xampp) and *nix (SUSE). Test case: Upload the same file twice over wp_handle_upload.

    Windows: wp_handle_upload finds the previously uploaded file with the same name, appends a number to the current filename and saves it under that name. After looking into the code this seems to be the desired behaviour.

    *nix: wp_handle_upload overwrites the old file which leads to two database entries referencing the same file (with all ugly consequences)

    May this happen due to a misusage of the wp_handle_upload function or may it be a bug? This would be my call:

    $uploadedFileInfo = wp_handle_upload($_FILES['yapb_imageupload'], array('action' => $_POST['action']));

    (May be found in Yapb.class.php line 387 which may be downloaded in the zip to be found at http://johannes.jarolim.com/blog/wp-content/uploads/File/yet-another-photoblog-beta-1.4.4.zip)

    Thanks in advance for any help and
    Greets from Salzburg,

    Johannes

Topic Closed

This topic has been closed to new replies.

About this Topic