I am using dropzone.js in my angularjs and .net application to upload files. dropzone.files
has the uploaded files, I have my own custom angularjs method where I take the Base64String
from the dropzone.files
and send that string to server and convert that string to Image
. Its working fine for images but not with other file types like .docx or pdf. I am basically trying to send dropzone.files
to my server and have them converted to HttpPostedFileBase
. How do I achieve this?
here is my angularjs controller:-
$scope.create = function () {
MyService.create($scope.viewModel, $scope.dropzone.files, function () {
alert.success("success");
});
};
here is my c# controller:-
[HttpPost]
[AuthenticationFilter(Disabled = true)]
public JsonResult Create(string data, string file)
{
using (MemoryStream memoryStream = new MemoryStream(Convert.FromBase64String(file.Remove(0, 23))))
{
Image image = Image.FromStream(memoryStream);
image.Save(Server.MapPath("~/images/im111.jpeg"));
}
}