File tree 2 files changed +18
-2
lines changed
2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -56,3 +56,19 @@ function get_png()
56
56
file_put_contents ($ tmp_filename , create_png ());
57
57
return $ tmp_filename ;
58
58
}
59
+
60
+ if (function_exists ('finfo_open ' )) {
61
+ function mime_type ($ file_path )
62
+ {
63
+ $ finfo = finfo_open (FILEINFO_MIME_TYPE );
64
+ $ mime_type = finfo_file ($ finfo , $ file_path );
65
+ finfo_close ($ finfo );
66
+ return $ mime_type ;
67
+ }
68
+ } else {
69
+ function mime_type ($ file_path )
70
+ {
71
+ $ mime_type = mime_content_type ($ file_path );
72
+ return $ mime_type ;
73
+ }
74
+ }
Original file line number Diff line number Diff line change 105
105
echo $ http_raw_post_data ;
106
106
exit ;
107
107
} elseif ($ test === 'post_file_path_upload ' ) {
108
- echo mime_content_type ($ _FILES [$ key ]['tmp_name ' ]);
108
+ echo Helper \mime_type ($ _FILES [$ key ]['tmp_name ' ]);
109
109
exit ;
110
110
} elseif ($ test === 'put_file_handle ' ) {
111
111
$ tmp_filename = tempnam ('/tmp ' , 'php-curl-class. ' );
112
112
file_put_contents ($ tmp_filename , $ http_raw_post_data );
113
- echo mime_content_type ($ tmp_filename );
113
+ echo Helper \mime_type ($ tmp_filename );
114
114
unlink ($ tmp_filename );
115
115
exit ;
116
116
} elseif ($ test === 'request_method ' ) {
You can’t perform that action at this time.
0 commit comments