File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -69,7 +69,11 @@ public function handle_file($file){
6969 $ finalfilename = $ this ->uid . '. ' . $ extension ;
7070 $ path = $ context . '/ ' . $ finalfilename ;
7171 $ realpath = $ this ->build_path ($ context ).'/ ' .$ finalfilename ;
72- move_uploaded_file ($ tmp_name , $ realpath );
72+
73+ if (!move_uploaded_file ($ tmp_name , $ realpath )) {
74+ throw new Exception ('Can \'t move file: ' .(string )$ tmp_name );
75+ }
76+
7377 $ this ->name = $ file ["name " ];
7478 $ this ->size = $ file ["size " ];
7579 $ this ->path = $ path ;
@@ -89,7 +93,12 @@ protected function build_path($context){
8993 $ path = DOC_STORE .$ this ->upload_path .(substr ($ context ,0 ,1 ) == '/ ' ?'' :'/ ' ).$ context ;
9094 if ( ! file_exists ($ path ) ){
9195 $ oldumask = umask (0 );
92- mkdir ($ path , 0775 , true ); // or even 01777 so you get the sticky bit set
96+
97+ // or even 01777 so you get the sticky bit set
98+ if (!mkdir ($ path , 0775 , true )) {
99+ throw new Exception ('Can \'t build path: ' .(string )$ path );
100+ }
101+
93102 umask ($ oldumask );
94103 }
95104 return $ path ;
You can’t perform that action at this time.
0 commit comments