Jump to content

Cannot upload virtual products


Recommended Posts

Hi,

 

I tried to upload a virtual server product size products: 33,2 MB but it is not possible, why? 

 

Detail my server VPS:

 

Server information: Linux #1 SMP Mon Jul 1 20:48:07 MSK 2013 x86_64
Server software version: Apache
PHP version: 5.3.3
Memory limit: 128M
Max execution time: 60
Upload max filesize: 128M
Max file uploads: 20
 
Database information
 
MySQL version: 5.1.73
MySQL engine: MyISAM
Store information
PrestaShop version: 1.5.4.1
Current theme in use: default
Your information
Your web browser: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/537.36
 
 Check your configuration
Required parameters: OK
Optional parameters: OK
 
thanks in advance for any help!
Edited by floriano (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...

Hey Floriano,

 

I think I have your answer. There is a constant set at 10MB in the Uploader.php file. This is located in the /classes folder.

 

It is set in bytes, so you will need to increase it.

const DEFAULT_MAX_SIZE = 10485760;

20MB would be 20971520
100MB would be 104857600, etc...

 

We wrote an article for it on our Support Center since we had customers run across this as well. If you like, check it out below:
Fixing the virtual product upload error.

Edited by scottm (see edit history)
  • Like 1
Link to comment
Share on other sites

Hi Scottm,
thanks for your response but, I haven't in classes/uploader.php.
I have in classes only Upgrader.php
 
 const DEFAULT_MAX_SIZE

 

this is Upgrader.php

class UpgraderCore
{
	const DEFAULT_CHECK_VERSION_DELAY_HOURS = 24;
	public $rss_version_link = 'http://api.prestashop.com/xml/upgrader.xml';
	public $rss_md5file_link_dir = 'http://api.prestashop.com/xml/md5/';
	/**
	 * @var boolean contains true if last version is not installed
	 */
	protected $need_upgrade = false;
	protected $changed_files = array();
	protected $missing_files = array();

	public $version_name;
	public $version_num;
	public $version_is_modified = null;
	/**
	 * @var string contains hte url where to download the file
	 */
	public $link;
	public $autoupgrade;
	public $autoupgrade_module;
	public $autoupgrade_last_version;
	public $autoupgrade_module_link;
	public $changelog;
	public $md5;

	public function __construct($autoload = false)
	{
		if ($autoload)
		{
			$this->loadFromConfig();
			// checkPSVersion to get need_upgrade
			$this->checkPSVersion();
		}
	}
	public function __get($var)
	{
		if ($var == 'need_upgrade')
			return $this->isLastVersion();
	}

What's missing from my classes !?

Link to comment
Share on other sites

Hello floriano,

 

Apologies, my version of PrestaShop 1.5 had actually been upgraded to 1.6  You are not missing anything in your version, the coding change happened in 1.6.

 

When testing the default installl the Virtual Product upload would not allow me to upload anything above 16MB exactly. I did get an error message saying "Could not upload file." , however.

 

In looking at the default setup, my limitation was due to the post_max_size setting in my php.ini file being set to 16M. Once I upped that, the file uploaded. In further testing, I did not find a specific size limit for the Virtual Products like there is in 1.6.x

 

It is strictly limited by both the post_max_size and the upload_max_filesize. Since my upload_max_filesize was set to a high 256, it had no effect on my upload.

 

Another thing to consider, if you did bump the upload_max_filesize and post_max_size to significant sizes but still are unable to upload, be sure that your php.ini file is set to be recursive. If it is not, the file doing the upload may be running off of the server default php.ini file which may be much more restrictive.

 

Let us know if this helps!

 

Kindest Regards,
Scott M - InMotion Hosting Customer Community

Link to comment
Share on other sites

Hello floriano,

 

There is one other thing you may want to check. This involves your hosting company. On our servers, there is a limit of 128MB set for all uploads using Apache. This is governed by the Apache security module. Even if PrestaShop is se to allow much larger files, it will not upload anything larger than the 128MB.

 

The bad part is that PrestaShop does not give an error when this happens because it does not throw an error that prestashop checks for, nor is it a php error. I had to find it by tracing and watching the Apache error logs for the customer who was having the issue.

 

Check with your hosting company to see if they have a mod_security rule set to disallow uploads over a certain size. If that is the case they may have other plans available that allow larger file uploads.

 

Kindest Regards,

Scott M

Link to comment
Share on other sites

  • 7 months later...
  • 3 months later...

I would like to bump this since it seems to be the best solution when the problem was around before. It's back!!!!  in 1.6.0.14

 

PHP Max upload filesize is 10MB.  I've even tried 128.

PHP Max post is 10MB  I've even tried 128.

 

classes/Uploader.php

 
const DEFAULT_MAX_SIZE = 104857600;  //100
 

Module Virtual Product Combinations uses file upload tool here:

 

echo Module::getInstanceByName('combinationsfile')->fileUpload(Tools::getValue('id_attribute'), Tools::getValue('token'));

 

When trying to upload a 2.9mb file the following is received.

The uploaded file exceeds the "Maximum size for a downloadable product" set in preferences (2MB) or the post_max_size/ directive in php.ini (2MB).

 

Testing with a basic Virtual Product with single file and no combinations and it does the same thing.

 

Wil

Edited by A-Z Hosting (see edit history)
Link to comment
Share on other sites

Hm, I wonder if there is some ini_set somewhere that overrides it to 2mb. at this point. THe only one I found was in config.inc, this

 

 
if (Tools::convertBytes(ini_get('upload_max_filesize')) < Tools::convertBytes('100M'))
ini_set('upload_max_filesize', '100M');
Link to comment
Share on other sites

That's all I am finding as well. Everything else grabs the values from ini_get passing it through getOctet in Tools then divides upon it.  So 10MB going in and 10 comes out and I also tested this by passing it thru the same getOctet function.   I'm going to go ahead and create a ticket in the forge as there is an obscure bug somewhere.

 

Thanks

 

Wil

Link to comment
Share on other sites

  • 2 months later...

Hi guys 

I tried uploading a pdf user guide  and get this error message. I have compressed the pdf file but still get the error message. Is it my hosting company or is there a setting in presta shop that I could change? Thanks for any advice: Kind regards

Len

Upload error. Please check your server configurations for the maximum upload size allowed.
 
Link to comment
Share on other sites

  • 3 weeks later...

HI guys 

The pdf file size is within the limits of ovh and prestashop 1.6. I have one user manual in English which is uploaded in the english language add. The French user manual therefore not loading. Is this normal? Can I have one pdf in English and in the French 'section' of the add the French pdf file? I think that is why the french pdf is not loading. Am I right? If not is there a way I can  have both the french and the english pdf user guides as seperate downloads for one add?

Thanks for your advice

Kind regards

Len

Link to comment
Share on other sites

  • 8 months later...
×
×
  • Create New...