[Joomla] Uploading Error - JFolder:create: Infinite loop detected

I am a Joomla newbie who found errors and searched around to find the way out. For Joomla! users who found the below error while uploading a component or a plugin to a web hosting server, I would like to suggest the following solution which I believe it can help you as it did for me.

---------------------------------------------------------------------------
JFolder::create: Infinite loop detected
Warning! - Failed to move file
/home/**yourusername**/public_html/libraries/joomla/filesystem/folder.php on line 362
---------------------------------------------------------------------------

The problem is the incorrect folder path. Please open the Configuration.php file and do the following;

Find var $log_path = 'yourCurrentPath';
Please change to var $log_path = '/home/yourUserName/public_html/logs';

Do the same for tmp path
Please change to var $tmp_path = '/home/yourUserName/public_html/tmp';

The username I mentioned is the one you use for your website. Then save and try to upload your file(s) again.

Please also make sure that the folders are Chmod 777. Otherwise, there will be many errors showing like "failed to copy or failed to move the file".

Good luck :)