fileupload element filename cleaning

Status
Not open for further replies.
If a file whose name contains non-alphanumeric characters (e.g. space or %) is selected, its name is shown as is with no changes, even though Clean Filename is set to Yes. On saving the message, “File type not allowed” is shown below the element name, the filename is replaced by “No file selected” and the error message “Some parts of your form have not been correctly filled in” is shown at the top of the form.

If the file’s name is changed to remove the non-alphanumeric characters (and the extension is left unchanged) and it is then selected again, it uploads successfully. What can stop Clean Filename from working?

Fabrik 4.0delta, Joomla 4.3.3, PHP 8.0.29.
 
I assume you have a simple fileupload (no ajax)?

The CleanFilename is working, but it's done on save (so until then it's showing the original).
A file selected in a simple fileupload will be gone on any validation error on your form (because of???, somebody said it's a "HTML thing").
So in principal this is the expected behaviour.

I can't replicate on my local host, but this is where I don't have these MIME checking issues.
Maybe CleanFilename (Fabrik) and file type check (Joomla) are conflicting in this case.

Did you try with this Media Options MIME check=no?
 
I assume you have a simple fileupload (no ajax)?
Correct.
Did you try with this Media Options MIME check=no?
Changing Check MIME Types makes no difference.

I notice that the message is “File type not allowed”, but presume that covers name problems as well; I have tried both .pdf and jpg.

I did spend a while looking through the code to try and find where the filename cleaning is done, but without success.
Perhaps it would be easiest to add an onChange JS and do the cleaning myself.
 
The function cleanName()
is in plugins\fabrik_element\fileupload\adaptors\filesystemstorage.php line 193,
called several times in plugins\fabrik_element\fileupload\fileupload.php
 
It’s not so difficult when you know where to look!

The trouble was caused by my setting Allowed File Types to “*” (a single asterisk). That works for the File Upload dialog, but not for _fileUploadFileTypeOK() which needs every file type in the csv list. Pasting the list from Joomla’s Allowed Extensions into Allowed File Types fixes it.

The only question remaining is why Fabrik does not pick up that list if Allowed File Types is blank.
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top