I am trying to upload image in cakephp through ajax everything looks good but when i click select image the page give error in popup box like in image
my view code is
- ">
" onchange="upload();" class="browse" type="file" name="myfile[]">
webroot?>images/ajax-loader.gif" class="img_loader" id="img_loader" style="display:none;">
</div>
function upload($data){
//alert($data);
file_data = jQuery('#browse'+$data).prop("files")[0];
/* var id = 'browse'+$data;
alert('browse'+$data);
var fileInput = document.getElementById(id);
var file_data = fileInput.files[0]; */
jQuery.ajax({
type: "POST",
url: "webroot?>index/upload",
data: "file="+file_data,
cache: false,
success: function($resasas)
{
alert($resasas);
}
});
}
i doesn't recognize this error please help .this is only uploading error not submit.
0 comments:
Post a Comment