Follow these steps to solve the problem:
-Log in to your WordPress admin panel (wp-admin).
-In the left menu go to Settings » Media.
-In the Store uploads in this folder field enter: wp-content/uploads and click Save changes.
-Now you are done, go and try to upload files to the media library again.
NOTE: make sure that the Store uploads in this folder field contain wp-content/uploads only.
If you can’t find the field in your media settings page you can solve the problem by adding the following code in your “wp-config.php” file:
define( 'UPLOADS', 'wp-content/uploads' );
but, make sure to add the code before this line:
require_once(ABSPATH . 'wp-settings.php');
Also, make shure that the parent directory is writable and error will be solved.