• Resolved danrancan

    (@danrancan)


    I am running WordPress on a Raspbian Buster LEMP server. For the most part, everything is working fine except some problems with uploading photos using the command line interface. I have many pictures in my servers ~/Pictures folder that I am trying to upload to wordpress using the command line interface.

    I navigate to the root directory of my wordpress installation and run the following command:
    wp media import ~/Pictures/*.jpg
    To which I get the following errors:
    Warning: Unable to import file '/home/Danran/Pictures/img_0754.jpg'. Reason: The uploaded file could not be moved to wp-content/uploads/2020/03.
    for each corresponding file. I am fairly certain that this is some sort of permissions error, but because I am a noob, I don’t want to risk tinkering around with permissions in my wordpress directory without some sort of guidance by a pro.

    Please let me know how I can get rid of this error and successfully import my photos to wordpressing using the wp-cli. Thank you kindly for any and all answers/suggestions!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Tyler

    (@tylerthedude)

    Hi there,

    This could very well be an issue with permissions considering you’re interacting directly on the server’s command-line instead of uploading the file via PHP. I’d recommend temporarily changing the wp-content/uploads/2020/03 directory permissions to 766 and see if that helps. If the same error occurs, try changing it to 767, 775 or 777. Once the file uploads successfully, then switch the directory back to 755 and see if that works as expected.

    Regards,
    Tyler

    Thread Starter danrancan

    (@danrancan)

    changing the permissions using chmod 775 wp-content/uploads/2020/03 seemed to work! 766 and 767 did not. Does this mean that anytime I want to upload files with the wordpress command line, I must change permissions of the folder the files are being uploaded to and then changing them back? Is there any easier way to do this without modification while maintaining security? Lastly, why would the wp-cli not be able to upload in the first place? Wouldn’t you think that because it is a wordpress utility, that I shouldn’t have this problem after a default install? Seems a bit odd to me and I am curious.

    Either way, thank you very much. You did help me find a solution here! Thank you thank you!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘WordPress (wp-cli): Unable to import file. Permissions error?’ is closed to new replies.