mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-25 03:08:51 +02:00
Allow to restrict the file extensions for a attachment type.
This commit is contained in:
parent
2187f5eac2
commit
fdfb099cb5
25 changed files with 714 additions and 4 deletions
|
@ -56,6 +56,7 @@ use App\Entity\Base\StructuralDBElement;
|
|||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use App\Validator\Constraints\ValidFileFilter;
|
||||
|
||||
/**
|
||||
* Class AttachmentType.
|
||||
|
@ -91,6 +92,7 @@ class AttachmentType extends StructuralDBElement
|
|||
/**
|
||||
* @var string
|
||||
* @ORM\Column(type="text")
|
||||
* @ValidFileFilter
|
||||
*/
|
||||
protected $filetype_filter = "";
|
||||
|
||||
|
@ -112,6 +114,8 @@ class AttachmentType extends StructuralDBElement
|
|||
|
||||
/**
|
||||
* Gets an filter, which file types are allowed for attachment files.
|
||||
* Must be in the format of <input type=file> accept attribute
|
||||
* (See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#Unique_file_type_specifiers).
|
||||
* @return string
|
||||
*/
|
||||
public function getFiletypeFilter(): string
|
||||
|
@ -129,8 +133,6 @@ class AttachmentType extends StructuralDBElement
|
|||
return $this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the ID as an string, defined by the element class.
|
||||
* This should have a form like P000014, for a part with ID 14.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue