@@ -1117,37 +1117,12 @@ protected function handle_file_upload($uploaded_file, $name, $size, $type, $erro
11171117 $ append_file = $ content_range && is_file ($ file_path ) &&
11181118 $ file ->size > $ this ->get_file_size ($ file_path );
11191119 if ($ uploaded_file && is_uploaded_file ($ uploaded_file )) {
1120- // multipart/formdata uploads (POST method uploads)
1121- if ($ append_file ) {
1122- file_put_contents (
1123- $ file_path ,
1124- fopen ($ uploaded_file , 'r ' ),
1125- FILE_APPEND
1126- );
1127- } else {
1128- chmod ($ uploaded_file , 0644 );
1129- // move_uploaded_file($uploaded_file, $file_path);
1130- exec (VESTA_CMD . "v-copy-fs-file " . USERNAME ." {$ uploaded_file } ' {$ file_path }' " , $ output , $ return_var );
1131-
1132- $ error = check_return_code ($ return_var , $ output );
1133- if ($ return_var != 0 ) {
1134- //var_dump(VESTA_CMD . "v-copy-fs-file {$user} {$fn} {$path}");
1135- //var_dump($path);
1136- //var_dump($output);
1137- $ file ->error = 'Error while saving file ' ;
1138- // var_dump(VESTA_CMD . "v-copy-fs-file ". USERNAME ." {$uploaded_file} {$file_path}");
1139- // var_dump($return_var);
1140- // var_dump($output);
1141- // exit();
1142- }
1120+ chmod ($ uploaded_file , 0644 );
1121+ exec (VESTA_CMD . "v-copy-fs-file " . USERNAME ." {$ uploaded_file } ' {$ file_path }' " , $ output , $ return_var );
1122+ $ error = check_return_code ($ return_var , $ output );
1123+ if ($ return_var != 0 ) {
1124+ $ file ->error = 'Error while saving file ' ;
11431125 }
1144- } else {
1145- // Non-multipart uploads (PUT method support)
1146- file_put_contents (
1147- $ file_path ,
1148- fopen ('php://input ' , 'r ' ),
1149- $ append_file ? FILE_APPEND : 0
1150- );
11511126 }
11521127 $ file_size = $ this ->get_file_size ($ file_path , $ append_file );
11531128
0 commit comments