Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setSanitizedFilename example
if
(
$replace
=== FileSystemInterface::EXISTS_REPLACE
)
{
$existingFile
=
$this
->
loadByUri
(
$file
->
getFileUri
(
)
)
;
if
(
$existingFile
)
{
$file
->fid =
$existingFile
->
id
(
)
;
$file
->
setOriginalId
(
$existingFile
->
id
(
)
)
;
}
}
$result
=
(
new
FileUploadResult
(
)
)
->
setOriginalFilename
(
$originalName
)
->
setSanitizedFilename
(
$filename
)
->
setFile
(
$file
)
;
// If the filename has been modified, let the user know.
if
(
$event
->
isSecurityRename
(
)
)
{
$result
->
setSecurityRename
(
)
;
}
// Set the permissions on the new file.
$this
->fileSystem->
chmod
(
$file
->
getFileUri
(
)
)
;
// We can now validate the file object itself before it's saved.