Nguyen Minh Tuan
Nguyen Minh Tuan

Reputation: 33

Cannot upload large video to server

I'm using cakephp for my project. Here is my server's setting:

<?php
$config['PHP']['max_execution_time'] = '10000';     // session timeout (second) セッション有効期間 (秒単位) 
$config['PHP']['max_input_time'] = '10000';         

// File upload
$config['PHP']['post_max_size'] = '5000M';
$config['PHP']['memory_limit'] = '20000M';
$config['PHP']['upload_max_filesize'] = '5000M';

When I submit a form that uploads large size video (>100M), it lost all submitted parameters. But everything goes OK if I submit small size video. Please help me to solve this problem.

Upvotes: 0

Views: 224

Answers (2)

QuyLT
QuyLT

Reputation: 41

You change value of post_max_size in file php.ini example: post_max_size = 500M

Plz read more here: https://www.php.net/manual/en/ini.core.php#ini.post-max-size

Upvotes: 0

Niclas Larsson
Niclas Larsson

Reputation: 1317

Basically there is four options in php.ini that would preduce this. To change this at runtime you could use the following:

memory_limit

ini_set( 'memory_limit', '256M' );

max_execution_time

ini_set( 'max_execution_time', 3600 ); or set_time_limit( 3600 );

post_max_size

Must be set in php.ini

Should be more than upload_max_filesize

upload_max_filesize

Must be set in php.ini as of the file would already be uploaded when the script is executed.

Looks like cakephp is using its own config system though.

You could validate this by running the following code in the end of your scripts:

var_dump( ini_get( 'memory_limit' ) );
var_dump( ini_get( 'max_execution_time' ) );
var_dump( ini_get( 'max_execution_time' ) );
var_dump( ini_get( 'post_max_size' ) );

Upvotes: 1

Related Questions