initialPreviewConfig url do not set after upload image.

Web Tips Q & ACategory: Krajee PluginsinitialPreviewConfig url do not set after upload image.
roger asked 6 months ago

In my server side I have this steps to configure the plugin in the JSON return after upload the image.

 $key = $result;
$url = '../../models/arg/delete.php?delete';
$p1 = '../../../images/products/'.$key;
$p2 = ['size' => $_FILES["edProductImage"]["size"], 'width' => '350px', 'url' => $url, 'key' => 1];

if ($result != 'Erro'){
echo json_encode([
'initialPreview' => $p1,
'initialPreviewConfig' => $p2,
'append' => true
]);
}else{
echo json_encode("ERRO");
}


The upload process is occurring normally, the problem is when i try to delete the image after upload, nothing happens. The trash button don´t send a request
to the $url specified.

This way I cannot delete the image, what I´m doing wrong?

This is my plugin initialization:

  $('#edProdutcImage').fileinput({
language: 'pt-BR',
maxFileSize: 1024,
allowedFileExtensions: ['jpg', 'jpeg', 'png'],
uploadAsync: false,
uploadUrl: url,
resizeImage: true,
maxImageWidth: 350,
maxImageHeight: 262.5,
maxFileCount: 1,
resizePreference: 'width',
initialPreviewAsData: true,
uploadExtraData: function() {
return {
SaveImage: '',
codProd: $("#edCodigo").val()
};
}
});
 

Login or register to contribute or comment.

Login   Register