Hi all, I’ve just updated my php.ini file on my server with all settings and rebooted apache.
Infact, I try this simple script out of Yii2 and i uploaded succesfully an image of 25Mb.
//upload.php
<form enctype="multipart/form-data" action="upload.php" method="POST">
<p>Upload your file</p>
<input type="file" name="uploaded_file" ></input><br />
<input type="submit" value="Upload"></input>
</form>
if(!empty($_FILES['uploaded_file']))
{
$path = "uploads/";
$path = $path . basename( $_FILES['uploaded_file']['name']);
if(move_uploaded_file($_FILES['uploaded_file']['tmp_name'], $path)) {
echo "The file ". basename( $_FILES['uploaded_file']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
}
?>
Now I have a simple form in Yii2 like this:
<?php $form = ActiveForm::begin([
'id' => 'file-upload-image',
'fieldConfig' => [
'options' => [
'tag' => false,
],
],
'options'=>['enctype'=>'multipart/form-data']
]); ?>
<?= $form->field($imp, 'file[]')->fileInput(['multiple' => true, 'accept' => 'image/*']) ?>
<div class='box-footer'>
<div class="form-group">
<?= Html::submitButton('N>ext', ['class' => 'btn btn-success','style' => "margin: 10px auto; display: block;"]) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
My problem is that i’m able only to upload image until 10Mb (in my php.ini settings i set 200Mb both post_max_size and upload_max_filesize)
I don’t find any error message, in the console tab, in the network tab of my browser.
I see that the submit doesn’t start if i press submit button.
I try to debug Yii.js on submit button but i lose myself in the code and i can’t understand where’s the problem. I only see that it stop submit propagation for some reason.
Can anyone give me any help?
Thank’s
this is my model
<?php
namespace app\models;
use yii\base\Model;
use yii\web\UploadedFile;
/**
* UploadForm is the model behind the upload form.
*/
class UploadForm extends Model
{
/**
* @var UploadedFile|Null file attribute
*/
public $file;
/**
* @return array the validation rules.
*/
public function rules()
{
return [
[['file'], 'file', 'extensions' => ['png', 'jpg', 'jpeg','gif'], 'maxSize' => 1024 * 1024 * 50],
];
}
}