Answer the question
In order to leave comments, you need to log in
How to update image from kartik/fileinput?
Good afternoon, I'm parsing the
kart/fileinput
https://github.com/kartik-v/yii2-widget-fileinput
So I got to the part where I need to update the pictures, I did the deletion and update the picture.
I send the image to the server. Here's what came
in var_dump($_POST, $_FILES);
array(1) {
["file_id"]=>
string(1) "2"
}
array(1) {
["photo_image"]=>
array(5) {
["name"]=>
array(1) {
[0]=>
string(12) "02151004.JPG"
}
["type"]=>
array(1) {
[0]=>
string(10) "image/jpeg"
}
["tmp_name"]=>
array(1) {
[0]=>
string(14) "/tmp/phpjHYX2D"
}
["error"]=>
array(1) {
[0]=>
int(0)
}
["size"]=>
array(1) {
[0]=>
int(6258693)
}
}
}
if(\Yii::$app->request->isPost) {
$photos = new Photo();
$photos->photo_image = UploadedFile::getInstance($photos, 'photo_image');
var_dump($photos); //photo_image = null
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question