@mujaheed
change the $path and $files path both

chmod the files and temp folder to 777