In server, script create new folder, set chmod to 0777, but then it tryes to move files to that folder i get error: Permission denied.
mkdir(\"../\".$new_1,
Do you have the write access to the file? If not, make sure you chmod the file to 777 or at least to 644.
Also, check the existence of the file by giving a file_exists() on the file name before you rename. :)
Also, after moving file, you might need to set the permissions using chmod() to make it available for renaming. You can do it this way: