Restrict upload size in total

  • Posts: 11
  • Thank you received: 0
9 years 11 months ago #182749

-- HikaShop version -- : 2.3.4
-- Joomla version -- : 3.3.6
-- PHP version -- : 5.3.29
-- Browser(s) name and version -- : Chrome 38.0.2125.111 m, Firefox 33.1.1

Hello,

I have an issue regarding the upload size of the files. Users can upload files with a maximum of 96mb. The problem is they can upload e.g. 10 files of 96mb in the same session/product. The result is that the upload folder contains too many files. Is it possible to restrict it somehow to 96mb in total?

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

  • Posts: 13201
  • Thank you received: 2322
9 years 11 months ago #182767

Hi,

You can change the MAX_POST_SIZE value in your php.ini file.
That can potentially be forced in the .htaccess file.

This is more a server issue than an HikaShop one ;)

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

  • Posts: 11
  • Thank you received: 0
9 years 11 months ago #182852

Hello,

My webhost won't let users access php.ini. I've asked the helpdesk. I also tried to force MAX_POST_SIZE with .htaccess, but that is also not supported by the webhost.

I was wondering if there is a way in hikashop/market to arrange this.

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
9 years 11 months ago #182888

Hi,

Which type of custom field are you using exactly ?
Depending the kind (classical or ajax) some things might be possible ; but it could require some extra development in order to create this special restriction (and having a appropriate file structure).

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.

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

  • Posts: 11
  • Thank you received: 0
9 years 11 months ago #183299

Hello Guys,

I think i'm using Ajax (see picture) otherwise there wouldn't be a progress bar at the bottom, right?

Attachments:

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
9 years 11 months ago #183366

Hi,

Yes you're using the ajax mode.
It means that the files are not upload in the same time but the interesting thing is that you can change dynamically the destination folder during the upload (and also refuse an upload if the destination folder is too big).

HikaMarket already use such kind of rules for the vendors (to change the destination folder ; there is no folder limitation for the moment but it's planned).

The idea is to have a specific folder for each user, so it requires that the users are log-in ; otherwise the guest accounts would all have the same folder and it will be problematic.
All the upload in the front-end is manage by the "upload controller" (components/com_hikashop/controllers/upload.php) and this controller can call the "base controller" in order to have some details about the current uploading.
In HikaShop, the item/order custom fields are managed by the controller order.

You'll find two functions in the order controller : "getUploadSetting" and "manageUpload".
The first one is to get the upload rules (like the upload destination folder) and the second one is to manage the uploaded file after his upload.
In your case, I think the best is to change the upload destination folder

$options = array(
	'upload_dir' => $config->get('uploadsecurefolder')
);
to use a sub directory depending the current user id.
And you can also check the size of the folder and return a "false" if this folder is too big.

Hope my explanations are clear enough and will help you.

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.

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

Time to create page: 0.074 seconds
Powered by Kunena Forum