WordPress.org

Ready to get started?Download WordPress

Forums

Dropbox Photo Sideloader
error when sideloading (8 posts)

  1. abacus718
    Member
    Posted 10 months ago #

    Sideloading /WE Bike Web Photos/WE Party-Michelle/P1070406_sm.jpg ... Error when sideloading.
    File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini.

    file uploads are ON in php.ini

    http://wordpress.org/extend/plugins/dropbox-photo-sideloader/

  2. Morgan Kay
    Member
    Posted 9 months ago #

    I ran into this problem as well, and for me it was a problem with having spaces in the URL I was trying to get (it looks like you probably have the same problem).
    There is an open ticket about this:
    https://core.trac.wordpress.org/ticket/16330

    As a desperate quick fix, I wound up changing my wp-admin/includes/file.php to change spaces into "%20"s -- though changing core files is a really bad idea! (I needed a solution Right Now, and I will be keeping track of the changes, as well as the ticket to see if it gets resolved.)

  3. Innomen
    Member
    Posted 6 months ago #

    This also happens if the dropbox folder you are sideloading from has spaces.

    "To Sideload" failed as above.

    "ToSideload" did not.

  4. jpw94
    Member
    Posted 4 months ago #

    It seems like it's NOT getting solved at this point.
    Morgan, you made a change to the file.php which changed spaces to "%20".
    Where, and how, would that be made exactly?

    Thanks in advance.

  5. loringllc
    Member
    Posted 4 months ago #

    Try this it works just fine, around line 214 in file dropbox-photo-sideloader.php in wp-content/plugins/dropbox-photo-sideloader

    replace:

    $result = media_sideload_image(urldecode($tempurl['url']), $post_id);

    with:

    $result = media_sideload_image(urldecode(rawurlencode($tempurl['url'])), $post_id);

    I also added:

    $file = rawurlencode($file);
    above:
    			echo "
    <li>Sideloading {$file} ... ";
    just for an intelligent check
    works current wp version as of this post.
    Merry Christmas</li>
  6. loringllc
    Member
    Posted 4 months ago #

    oops ! forgot one little wrinkle - if you don't change this line your file will have the %20 where the spaces where in file name saved on the server. so do this -
    replace:
    $file_array['name'] = basename($matches[0]);

    with:
    $file_array['name'] = preg_replace('/\s|%20/', '-', basename($matches[0]));
    in file
    wp-admin/includes/media.php
    ok its a core file but it works your file gets uploaded and gets saved as something you can use.

    You would think sideload function would sanitize the file names - oh well!

  7. loringllc
    Member
    Posted 4 months ago #

    Seems the issue is really a WP core problem with media_sideload_image(). preg_replace() between "\" and "." from right to left. before calling media_sideload_image(). That would have been my next thought. But then I could have my head in a dark place. :-)

  8. Dirty Bill
    Member
    Posted 4 months ago #

    Not RegeX familiar enough to contribute, but isn't there a filter for directly exchanging these codes for their ascii equiv? Ge gentle.

Reply

You must log in to post.

About this Plugin

About this Topic