Код: Выделить всё
echo FileInput::widget([
'name'=>'kartiks_file',
'options'=>['multiple' => false,],
'pluginEvents' => [
"filebatchuploadcomplete" => "function() { window.location = '/index.php?r=cart/index'}",
"filelock" => "function(event, filestack, extraData) {
article = document.getElementById('col-article').value;
qty = document.getElementById('col-qty').value;
console.log(''.article+' - '+qty);
var obj = {};
var id = ''+article+'', val = qty;
obj[id] = val;
extraData = obj;
}",
],
'pluginOptions' => [
'uploadExtraData' => "function (previewId, index) {
article = document.getElementById('col-article').value;
qty = document.getElementById('col-qty').value;
console.log(''.article+' - '+qty);
var obj = {};
var id = ''+article+'', val = qty;
obj[id] = val;
extraData = obj;
return extraData;
}",
'encodeUrl' => false,
'uploadUrl' => Url::toRoute(['cart/file_upload']),
'maxFileCount' => 1,
'showPreview' => false,
]
]);