Media files exist in upload folder but not showing up

In my wordpress, I tried to upload my images by media uploader but it says “couldn’t create directory wp-content/uploads/2016/09″. Then I create the folders correctly. And now when I tried to upload my files by media uploader, it says “couldn’t move to directory wp-content/uploads/2016/09”. Finally I uploaded my images in the folder and then checked the media library and the media library saying “no media founds”.

Why is it happening?

Solutions Collecting From Web of "Media files exist in upload folder but not showing up"

Just by uploading files into the wp-content/uploads won’t show up in the Media Library , those media ID’s needs to be there in the database to show up in the Media Library.

If you already have files in the uploads folder and want to add them into the database, you can use this plugin to add files from server.

But this is not the correct solution instead fix the permissions issue for that uploads folder.

Media files exist in upload folder but not showing up
Simply Paste this code in wpconfig.php and save it all is done 🙂

define( 'UPLOADS', 'wp-content/'.'uploads' );