Don’t works callback in uploader, i have used manual send, this is the code on client:
{view:"uploader",
name:"upload",
autosend:false,
id:"upload",
type:"iconButton",
multiple:false,
icon:"plus-circle",
accept:"image/jpg,image/png",
label:"Añadir imágenes",
link:"lista",
upload:"upload.php",
datatype:"json",on:{
onBeforeFileAdd:function(item){
var type = item.type.toLowerCase();
if (type != "jpg" && type != "png"){
webix.message("Solo se admiten imágenes formato: *.jpg y *.png");
return false;
}
}
}},
{view:"list", id:"lista", type:"uploader", autoheight:true, borderless:true},
{view:"button", label:"Subir fichero", click:function(){
$$('upload').send(function(response){
alert(response);
if(response){
webix.message(response.status);
webix.message(response.sname);
}
});
}},
And This on server, with response:
$archivo = $_FILES['upload']['name'];
$temporal = $_FILES['upload']['tmp_name'];
$destino = "imgs_noticias//".basename($archivo);
if(move_uploaded_file($temporal, $destino)){
echo "{ status: 'server', sname: '$archivo' }";
}else{
echo "{ status: 'error' }";
}
the server return a json response, but callback doesn’t show any message