I have an ImageUploadHandler.ashx
handler in my WebApi Project. Source code is available here. I am trying to call my handler from my AngularJs project. Here is the code:
var serviceBase = 'http://baseDomain/';
var plupload = null;
$scope.uploadedFiles = [];
$scope.fileUpload = {
url: serviceBase + 'ImageUploadHandler.ashx',
options: {
multi_selection: true,
drop_element: "pluploadDropzone",
chunk_size: '200kb',
runtimes: 'html5,flash,silverlight,html4',
browse_button: "pluploadDropzone",
container: "pluploadContainer",
max_file_size: '3mb',
mime_types: [{ title: 'Allowed', extensions: 'jpeg, jpg, png, gif' }]
},
callbacks:
{
filesAdded: function (uploader, files) {
plupload = uploader;
for (var i = 0 ; i < files.length ; i++) {
var file = files[i];
$scope.uploadedFiles.push(file);
plupload.start();
}
}
}
}
Html:
<div id="pluploadContainer" class="uploader">
<a ng-hide="uploadedFiles.length >= 10" id="pluploadDropzone"
plupload="fileUpload.url"
plupload-options="fileUpload.options"
plupload-callbacks="fileUpload.callbacks"
class="dropzone html5Dropzone" style="width: 464px;">
<span ng-hide="uploadedFiles.length >= 10" class="instructions html5Instructions">
Drag & Drop Your Files Here!
</span>
</a>
<div class="m-images">
<ul class="images">
<li ng-repeat="file in uploadedFiles" class="image">
<div class="thumbnail">
{{ file.name }}
</div>
<a ng-click="deleteImage(file)" class="delete">×</a>
</li>
</ul>
</div>
I am getting 404 error while calling this handler, Here is the error snapshot: