Home » Php » javascript – Multiple image upload issue

javascript – Multiple image upload issue

Posted by: admin February 25, 2020 Leave a comment

Questions:

i am creating a multiple image uploader in yii2.
My file upload widget like below

<?=$form->field($model, 'file[]')->widget(FileInput::classname(), [
    'pluginOptions' => [
        'initialPreview'=>[
            "http://upload.wikimedia.org/wikipedia/commons/thumb/e/e1/FullMoon2010.jpg/631px-FullMoon2010.jpg",
            "http://upload.wikimedia.org/wikipedia/commons/thumb/6/6f/Earth_Eastern_Hemisphere.jpg/600px-Earth_Eastern_Hemisphere.jpg"
        ],
        'initialPreviewAsData'=>true,
        'initialCaption'=>"The Moon and the Earth",
        'initialPreviewConfig' => [
            ['caption' => 'Moon.jpg', 'size' => '873727'],
            ['caption' => 'Earth.jpg', 'size' => '1287883'],
        ],
        'showPreview'=>true,
        'showCaption' => false,
        'showRemove' => false,
        'showUpload' => false,
        'showCancel' => false,
        'browseClass' => 'btn btn-theme btn-lg btn-block',
        'browseIcon' => '<i class="glyphicon glyphicon-camera"></i> ',
        'browseLabel' =>  'Select Photo',
        'overwriteInitial'=>false
    ],
    'options' => ['accept' => 'image/*','multiple'=>true]
]);?>

And the out image given below
enter image description here

in image we can see that for the initial preview images there is move icon to move the image and we can arrange the position.But when i select another file it doesn’t have the move icon. How can i add move button to the newly selected files.Because i don’t want to set initial Images

How to&Answers: