[Skip to main content](#vessel-content)

#   Restrict files upload by extension using triggers

##

- **[OPHWD](/forum/user/58074-ophwd "View OPHWD's Profile")**
- [![OPHWD's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/58074-ophwd "View OPHWD's Profile") Topic Author
- [ Offline](/forum/user/58074-ophwd)

Less More

- Posts: 19
- Thank you received: 0
-
-

7 years 3 weeks ago [\#312205](#312205) by [OPHWD](/forum/user/58074-ophwd "View OPHWD's Profile")  *[Restrict files upload by extension using triggers](/forum/31-development/898520-restrict-files-upload-by-extension-using-triggers#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.")* was created by *[OPHWD](/forum/user/58074-ophwd "View OPHWD's Profile")*

-- url of the page with the problem -- : [ teachersmarketplace.ca](http://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](https://www.hikashop.com/forum/23-market-how-to/897735-change-upload-limit-for-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](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg5ODUyMC1yZXN0cmljdC1maWxlcy11cGxvYWQtYnktZXh0ZW5zaW9uLXVzaW5nLXRyaWdnZXJzP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86541
- Thank you received: 14304
-
-

7 years 3 weeks ago [\#312229](#312229) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Restrict files upload by extension using triggers](/forum/31-development/898520-restrict-files-upload-by-extension-using-triggers#312229 "-- 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.")*

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](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg5ODUyMC1yZXN0cmljdC1maWxlcy11cGxvYWQtYnktZXh0ZW5zaW9uLXVzaW5nLXRyaWdnZXJzP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.043 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
