Remove file change ownership on file upload

This commit is contained in:
osaajani 2023-02-20 03:37:23 +01:00
parent 7c3bb65f8b
commit 9203e2426b
1 changed files with 1 additions and 11 deletions

View File

@ -48,7 +48,7 @@ class Media extends StandardController
if (!file_put_contents($new_file_path, 'a')) if (!file_put_contents($new_file_path, 'a'))
{ {
throw new \Exception('pute de merde'); throw new \Exception('Cannot write file ' . $new_file_path);
} }
if (!rename($tmpfile_path, $new_file_path)) if (!rename($tmpfile_path, $new_file_path))
@ -56,16 +56,6 @@ class Media extends StandardController
throw new \Exception('Cannot create file ' . $new_file_path); throw new \Exception('Cannot create file ' . $new_file_path);
} }
if (!chown($new_file_path, fileowner($user_path)))
{
throw new \Exception('Cannot give file ' . $new_file_path . ' to user : ' . fileowner($user_path));
}
if (!chgrp($new_file_path, filegroup($user_path)))
{
throw new \Exception('Cannot give file ' . $new_file_path . ' to group : ' . filegroup($user_path));
}
if (!chmod($new_file_path, self::DEFAULT_CHMOD)) if (!chmod($new_file_path, self::DEFAULT_CHMOD))
{ {
throw new \Exception('Cannot give file ' . $new_file_path . ' rights : ' . self::DEFAULT_CHMOD); throw new \Exception('Cannot give file ' . $new_file_path . ' rights : ' . self::DEFAULT_CHMOD);