Commit e2d7a8bc authored by Carsten  Rose's avatar Carsten Rose
Browse files

Refs #5103. Upload file type: * or *.*

parent e00853d2
......@@ -3032,6 +3032,10 @@ abstract class AbstractBuildForm {
$formElement[FE_FILE_MIME_TYPE_ACCEPT] = 'image/*';
}
if ($formElement[FE_FILE_MIME_TYPE_ACCEPT] == '*' || $formElement[FE_FILE_MIME_TYPE_ACCEPT] == '*.*') {
$formElement[FE_FILE_MIME_TYPE_ACCEPT] = '';
}
# Build param array for uniq SIP
$arr = array();
$arr['fake_uniq_never_use_this'] = uniqid(); // make sure we get a new SIP. This is needed for multiple forms (same user) with r=0
......
......@@ -112,6 +112,8 @@ class File {
}
/**
* doUpload
*
* @param string $sipUpload
* @param array $statusUpload
*
......@@ -136,8 +138,10 @@ class File {
$this->checkMaxFileSize($statusUpload['size']);
$accept = $this->store->getVar(FE_FILE_MIME_TYPE_ACCEPT, STORE_SIP);
if (!HelperFile::checkFileType($statusUpload['tmp_name'], $statusUpload['name'], $accept)) {
throw new UserFormException('Filetype not allowed. Allowed: ' . $accept, ERROR_UPLOAD_FILE_TYPE);
if (!($accept == '' || $accept == '*.*' || $accept == '*')) {
if (!HelperFile::checkFileType($statusUpload['tmp_name'], $statusUpload['name'], $accept)) {
throw new UserFormException('Filetype not allowed. Allowed: ' . $accept, ERROR_UPLOAD_FILE_TYPE);
}
}
// rename uploaded file: ?.cached
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment