Changeset 2786
- Timestamp:
- Oct 20, 2008, 11:06:21 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/ws_functions.inc.php
r2770 r2786 935 935 umask(0000); 936 936 $recursive = true; 937 mkdir($upload_dir, 0777, $recursive); 937 if (!@mkdir($upload_dir, 0777, $recursive)) 938 { 939 return new PwgError(500, 'error during directory creation'); 940 } 941 } 942 943 if (!is_writable($upload_dir)) 944 { 945 // last chance to make the directory writable 946 @chmod($upload_dir, 0777); 947 948 if (!is_writable($upload_dir)) 949 { 950 return new PwgError(500, 'directory has no write access'); 951 } 938 952 } 939 953 … … 946 960 // dump the photo file 947 961 $fh_file = fopen($file_path, 'w'); 948 fwrite($fh_file, base64_decode($params['file_content'])); 962 if (!fwrite($fh_file, base64_decode($params['file_content']))) 963 { 964 return new PwgError(500, 'error while writing file'); 965 } 949 966 fclose($fh_file); 950 967 chmod($file_path, 0644); … … 961 978 if (!is_dir($thumbnail_dir)) { 962 979 umask(0000); 963 mkdir($thumbnail_dir, 0777); 980 if (!@mkdir($thumbnail_dir, 0777)) 981 { 982 return new PwgError(500, 'error during thumbnail directory creation'); 983 } 984 } 985 986 if (!is_writable($thumbnail_dir)) 987 { 988 // last chance to make the directory writable 989 @chmod($thumbnail_dir, 0777); 990 991 if (!is_writable($thumbnail_dir)) 992 { 993 return new PwgError(500, 'thumbnail directory has no write access'); 994 } 964 995 } 965 996 … … 976 1007 // dump the thumbnail 977 1008 $fh_thumbnail = fopen($thumbnail_path, 'w'); 978 fwrite($fh_thumbnail, base64_decode($params['thumbnail_content'])); 1009 if (!fwrite($fh_thumbnail, base64_decode($params['thumbnail_content']))) 1010 { 1011 return new PwgError(500, 'error while writing thumbnail'); 1012 } 979 1013 fclose($fh_thumbnail); 980 1014 chmod($thumbnail_path, 0644); … … 994 1028 if (!is_dir($high_dir)) { 995 1029 umask(0000); 996 mkdir($high_dir, 0777); 997 } 998 1030 if (!@mkdir($high_dir, 0777)) 1031 { 1032 return new PwgError(500, 'error during high directory creation'); 1033 } 1034 } 1035 1036 if (!is_writable($high_dir)) 1037 { 1038 // last chance to make the directory writable 1039 @chmod($high_dir, 0777); 1040 1041 if (!is_writable($high_dir)) 1042 { 1043 return new PwgError(500, 'high directory has no write access'); 1044 } 1045 } 1046 999 1047 // high resolution path, same name as web size file 1000 1048 $high_path = sprintf( … … 1007 1055 // dump the high resolution file 1008 1056 $fh_high = fopen($high_path, 'w'); 1009 fwrite($fh_high, base64_decode($params['high_content'])); 1057 if (!fwrite($fh_high, base64_decode($params['high_content']))) 1058 { 1059 return new PwgError(500, 'error while writing high'); 1060 } 1010 1061 fclose($fh_high); 1011 1062 chmod($high_path, 0644);
Note: See TracChangeset
for help on using the changeset viewer.