Jump to content

Allowing customers to upload files


Recommended Posts

I need to give customers the ability to upload an image file when they place an order.

In the product customisation tab I've added the options for both file and text. This requires the customer to customise the item by uploading his image file before he can add it to his cart. This seems to work ok for small files but I need to upload big files - maybe 10mb. When I test it with a big file I get the error message "Maximum allowed: 131.072KB". Is there any way I can change this limit? Is there a good reason why it is set so low? I wouldn't want to create more problems down the line. I'm also not sure what happens to the file once it's uploaded. Where does it go and how do I access it?

Thanks
John

Link to comment
Share on other sites

I thought i was getting somewhere. I found that in the Back Office under Preferences/Products the last 3 entries seem to relate to my problem.....

Maximum size of product pictures: 131072
The maximum size of pictures uploadable by customers (in Bytes)


Product pictures width: 64
The maximum width of pictures uploadable by customers


Product pictures height: 64
The maximum height of pictures uploadable by customers

I've tried adjusting the numbers but I think the above are the defaults. I've just no idea what's going on. What units are the max picture width & height in? If it's supposed to be pixels then it's just ridiculously small. But even with the default of 64 for both I can upload an image of say 640 x 480 pixels! I've tried setting the Max size of pictures to 10000000 (10mb) and the picture width & height to 4000 & 4000 thinking it might relate to pixels but I still can't seem to upload a file of much more than 350kb. When the upload fails the page gets corrupted and I lose the whole of the centre and right hand columns.

I'm really stumped and I can't progress much further without solving this.

Just to add I'm on version 1.3.7.0

Any help much appreciated.

Thanks
John

Link to comment
Share on other sites

Hi
Can you confirm that when the upload of a large file fails you get an almost blank white page but when you try a small file it works OK. If so it is almost certainly the PHP settings of your host. To prove this have you tried editing the config.inc.php file in the config folder and change the following line:

@ini_set('display_errors', 'off');
to be

@ini_set('display_errors', 'on');

This wil then show any errors on the page after trying to upload a large image.

Let us know what they say

Link to comment
Share on other sites

Hi, Thanks for the reply.

Yes I can confirm the almost blank white page. I've modifed the config.inc.php file as you suggest and now when the upload fails I get an error ..

"Fatal error: Allowed memory size of 20971520 bytes exhausted (tried to allocate 7364 bytes) in /home/fhlinux221/u/xxxx/user/htdocs/images.inc.php on line 228"

Having checked line 228 it just says ...
return imagecreatefromjpeg($filename);

This was with only a 600kb size jpg so it's not a huge file.

What is this "Allowed memory size of 20971520 bytes" referring to? If it's relevant at all I'm with FastHosts.

Thanks,
John

Link to comment
Share on other sites

Rudders,

I've been doing a lot of searching on this forum and I've seen posts mention editing the php.ini file with respect to this sort of thing. It seemed that this is where you might have thought the problem was located so I've been looking into this. I can't actually see a php.ini file anywhere on my server and when I phoned FastHosts tech support they tell me that as I have a shared hosting package my php.ini file is not accessible to me as it is set for all shared users. They offered me a dedicated server for £70/month. This is way more than I want to pay at this stage.

So, is this the root of my problem? Do I have to pay that sort of money for a hosting package that will give me full access to PHP settings and everything?

John

Link to comment
Share on other sites

John,
Even with a shared host, thats what I have always had, you can sometimes have a local php.ini file that is specific to your installation of Prestashop and resides at the root of your Prestshop installation. You can also achieve the same by adding php directives to your .htaccess file. This does mean manually editing it after you have created one using Prestashop. Which one of these two options would work for you is a question to ask Fasthosts as I have no experence of them. There is a third option which involves your host modifying a config file and increasing teh limits just for your part of teh shared host, this is a last resort as it is totally outside of your control but something I have had to do with the hsot I move to some weeks back.

I would enquire with Fasthosts if they allow local php.ini files, it all depends on how they have configured PHP or if they can let you know if PHP directives can be added to the .htaccess file.
Regards

Link to comment
Share on other sites

You only have 20MB of ram, the minimum you should have is 32mb, but 64 is more likely what you will need.

Usually hosting companies has that pre-set, so no change to php.ini will be able to affect it.

As rudders suggested, contact your host and ask about upgrading to 64 mb, if you need a different host I can recommend a couple.

Link to comment
Share on other sites

To get it to work reliably on my current and last host I have had to have the memory limit set to 128M or 192M if I wanted customers to upload 3-5meg files. My last host had PHP configured to use the central ini file they create and then to look at the root of your website for a second ini file allowing you to change certain values such as the memory limit. My current host does not have it setup this way but I can add the PHP directives into the .htaccess file, this works unless you run PHP as an app with FastCGI.

You could easily try both and run phpinfo to check if anything has changed.

Link to comment
Share on other sites

Thanks guys. So it looks like I have 2 problems - only 20mb of ram which is nowhere near enough, and a PHP max file upload size of 2mb. I'm waiting for FastHosts to get back to me about local php.ini files and I will check with them about increasing my ram but I'm not overly hopeful about the outcome. Does rather seem that I have chosen the wrong hosting. Bit of a pain as I've just paid for a year.

Am I right in thinking that these limitations are only affecting this file upload function? If so, then for now I might just have to live without it and get customers to email their pics to me.

tomerg3, just for future reference by all means recommend a Prestashop friendly host.

Thanks,

John

Link to comment
Share on other sites

You may run into trouble down the line with only 20MB ram.

For a small- medium site, you can use bluehost (http://www.bluehost.com/track/tomer ) I have used them for over a year until I outgrew them and needed a VPS server.

For medium-large site, you can use inmotion (https://secure1.inmotionhosting.com/cgi-bin/gby/clickthru.cgi?id=tomerg3 ), I switched to them about 4 months ago, and have not had any downtime at all, their support is very good and fast.

Link to comment
Share on other sites

×
×
  • Create New...