Restrict files upload by extension using triggers

  • Posts: 19
  • Thank you received: 0
2 years 6 months ago #312205

-- url of the page with the problem -- : teachersmarketplace.ca
-- HikaShop version -- : 4.2.2
-- Joomla version -- : 3.9.12
-- PHP version -- : 7.1.14

Hi. I'm here related to question that was original started on HikaMarket Forum
www.hikashop.com/forum/23-market-how-to/...or-files.html#312195
I want to know if is possible to use new triggers: onBeforeFileCreate, onBeforeFileUpdate, onAfterFileCreate and onAfterFileUpdate.
to limit the file size dynamically depending on user group.
A lot of thanks for your help.

Please Log in or Create an account to join the conversation.

  • Posts: 75473
  • Thank you received: 11742
  • MODERATOR
2 years 6 months ago #312229

Hi,

I suppose it's possible. However, I'm not sure that the uploader will be able to properly take into account the failed saving of the file.
If you cancel the saving of the file in onBeforeFileCreate with the $do parameter set to false.
That will definitely prevent the file from being added in the hikashop_file table.
However, the file will still be uploaded in the upload folder. And I'm not sure the uploader will be able to properly display an error back to the customer.
So it's worth a try, but I can't guarantee it will work. That would require some development work to confirm that.

Please Log in or Create an account to join the conversation.

Time to create page: 0.053 seconds
Powered by Kunena Forum