equal
deleted
inserted
replaced
91 $type = $file['type']; // LAST RESORT: use the mimetype the browser sent us, though this is likely to be spoofed |
91 $type = $file['type']; // LAST RESORT: use the mimetype the browser sent us, though this is likely to be spoofed |
92 else // DANG! Not even the browser told us. Bail out. |
92 else // DANG! Not even the browser told us. Bail out. |
93 die_friendly('Upload failed', '<p>Enano was unable to determine the format of the uploaded file.</p>'); |
93 die_friendly('Upload failed', '<p>Enano was unable to determine the format of the uploaded file.</p>'); |
94 */ |
94 */ |
95 $types = fetch_allowed_extensions(); |
95 $types = fetch_allowed_extensions(); |
96 $ext = substr($file['name'], strrpos($file['name'], '.')+1, strlen($file['name'])); |
96 $ext = strtolower(substr($file['name'], strrpos($file['name'], '.')+1, strlen($file['name']))); |
97 if ( !isset($types[$ext]) || ( isset($types[$ext]) && !$types[$ext] ) ) |
97 if ( !isset($types[$ext]) || ( isset($types[$ext]) && !$types[$ext] ) ) |
98 { |
98 { |
99 die_friendly('Upload failed', '<p>The file type ".'.$ext.'" is not allowed.</p>'); |
99 die_friendly('Upload failed', '<p>The file type ".'.$ext.'" is not allowed.</p>'); |
100 } |
100 } |
101 $type = $mime_types[$ext]; |
101 $type = $mime_types[$ext]; |