mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-20 17:15:51 +02:00
Filter attachment name for uploaded filename.
This commit is contained in:
parent
11d45eaf59
commit
54986a9a52
1 changed files with 2 additions and 2 deletions
|
@ -203,8 +203,8 @@ class AttachmentHelper
|
|||
$folder = $this->generateFolderForAttachment($attachment);
|
||||
|
||||
//Sanatize filename
|
||||
$originalFilename = pathinfo($file->getClientOriginalName(), PATHINFO_FILENAME);
|
||||
$newFilename = $attachment->getName() . '-' . uniqid('', false) . '.' . $file->getClientOriginalExtension();
|
||||
$safeName = transliterator_transliterate('Any-Latin; Latin-ASCII; [^A-Za-z0-9_] remove; Lower()', $attachment->getName());
|
||||
$newFilename = $safeName . '-' . uniqid('', false) . '.' . $file->getClientOriginalExtension();
|
||||
|
||||
//Move our temporay attachment to its final location
|
||||
$file_path = $file->move($folder, $newFilename)->getRealPath();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue