How to delete files uploaded but not used

  • Posts: 14
  • Thank you received: 0
  • Hikamarket Multivendor Hikaserial Subscription Hikashop Business
1 week 6 days ago #308306

-- HikaShop version -- : 4.1.0
-- HikaMarket version -- : 3.0.2
-- Joomla version -- : 3.9.5
-- PHP version -- : 7.1
-- Error-message(debug-mod must be tuned on) -- : No error message

On add product process, when a file is uploaded and deleted before save the new product the file remains on server. How to avoid this behavior and delete the file on server when it is deleted on file uploader?

Attachments:

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

  • Posts: 23544
  • Thank you received: 3654
  • MODERATOR
1 week 5 days ago #308342

Hello,

The upload behavior when a product is not yet created is a bit tricky and HikaMarket and HikaShop are using the same workflow.
Since you do not have a product ID, the upload is made without a product assignation and it's only when you save the product that the files are then associated with the product just created.

One possible fix would be to perform an ajax call when the file is deleted, so it can be also delete in the server (with all the necessary security checks, obviously).
Another solution would be to use a cron task which will delete "old" non associated files. That part would also handle other kind of upload which can have the same kind of behavior.

The first solution can be implemented into HIkaMarket but it's not a kind of patch that I can do in a short time and give you the patch in the forum. Depending how the other developments are going, it might be something we can add in a future release.

Edit: In the mean time, if you're not using product approval : you can configure your HikaMarket ACL to not authorize the upload for "product/new" but only to "product/edit" ; so your vendors would be able to upload files only when the product already have an ID.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
Last edit: 1 week 5 days ago by Jerome.

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

  • Posts: 14
  • Thank you received: 0
  • Hikamarket Multivendor Hikaserial Subscription Hikashop Business
6 days 9 hours ago #308499

Perfect. A lot of thanks for your help I will explore that options to meet this requirement.
Best Regards !!

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

Moderators: Obsidev
Time to create page: 0.056 seconds
Powered by Kunena Forum