• Resolved Zerquix18

    (@zerquix18)


    I’m testing this plugin on my site and it keeps returning ‘The file could not be uploaded’.

    I debugged the code and it seems like ‘wp_attachment_is_image’ at line 858 (user-submitted-posts.php) is returning FALSE, even if what I upload is an actual image (JPG or PNG).

    In fact, if I exit the code right after the ‘else’ block, I can see that the image was successfully uploaded and is attached to the post (as shown here https://i.imgur.com/oQ85pAK.jpg).

    Any ideas on how to fix it? I can’t remove that condition for security reasons ??

    • This topic was modified 7 years, 4 months ago by Zerquix18.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Jeff Starr

    (@specialk)

    Yeah you don’t want to make changes to any core files, not recommended. What that particular line is checking for is whether or not there is an error and whether or not the file is actually an image.

    So if the line is returning true, then the best thing to do would be to put the site in maintenance mode, and then test further. For example, the first thing to look at would be the error, which you can do by adding this code to line #857, right after the media_handle_upload() line:

    die(var_dump($attach_id));

    If there is an error, that will tell you what it is. Otherwise, it will tell you the value of the $attach_id variable, which may help to understand what is happening.

    Thread Starter Zerquix18

    (@zerquix18)

    It returns int(9302)

    • This reply was modified 7 years, 4 months ago by Zerquix18.
    Plugin Author Jeff Starr

    (@specialk)

    That is not an error, so if your reporting is correct then the only other possibility is that the upload is failing at the check to see if the file is an actual image.

    From here, it’s really just a matter of troubleshooting to determine what’s happening. Things to look at include:

    – Different types of images
    – Different sizes of images
    – Different USP settings
    – Server settings
    – Folder permissions for uploads

    ..and things like that. I also would recommend setting up a default install of WP without making any changes or installing any other plugins. Then try USP and the image uploads again. That way you’ll eliminate a lot of other variables (like plugins, theme, settings, etc.).

    Plugin Author Jeff Starr

    (@specialk)

    Hi Zerquix18, I hope you got this sorted out. I’m gonna go ahead and mark this topic as resolved to help keep things organized. Feel free to follow-up or post afresh with any new issues or questions, I’m glad to help however possible. Thank you.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Error uploading the image’ is closed to new replies.