Prevent use whitespaces in files which users upload

Phoca Download - download manager
User avatar
fafnir1990
Phoca Newbie
Phoca Newbie
Posts: 6
Joined: 23 Dec 2015, 10:03

Prevent use whitespaces in files which users upload

Post by fafnir1990 »

Hello, is there any simple solution for preventing using whitespaces in files which users upload?
If not, please give me any suggestions how can I block files with whitespaces in names. Which script should I modify? Maybe a trigger in database?

Best regards
Rafal
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48550
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Prevent use whitespaces in files which users upload

Post by Jan »

Hi, didn't test it so I cannot give any clue advice, but before upload to the server, you should e.g. str_replace(' ', '_', $file); the file.

Upload functions you will find here:
administrator/components/com_phocadownload/libraries/phocadownload/file/fileupload.php

See the variable $file

Jan
If you find Phoca extensions useful, please support the project
User avatar
fafnir1990
Phoca Newbie
Phoca Newbie
Posts: 6
Joined: 23 Dec 2015, 10:03

Re: Prevent use whitespaces in files which users upload

Post by fafnir1990 »

Jan, thank you very much for your help!
Post Reply