$('input[type=file]').on('change', function(){previewPhoto(this);});
function previewPhoto(inputPhoto)
{
var fileName = inputPhoto.files[0].name.toLowerCase();
if (inputPhoto.files && inputPhoto.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#user-avatar').attr('src', e.target.result);
};
reader.readAsDataURL(inputPhoto.files[0]);
}
};
// INSERT
$connection->createCommand()->insert('user', [
'name' => 'Sam',
'age' => 30,
])->execute();
// INSERT multiple rows at once
$connection->createCommand()->batchInsert('user', ['name', 'age'], [
['Tom', 30],
['Jane', 20],
['Linda', 25],
])->execute();