I have an angular view that is uploading files via the template
Multiple
<input type="file" name="file" nv-file-select="" uploader="uploader" multiple /><br/>
Single
<input type="file" name="file" nv-file-select="" uploader="uploader" />
and the controller using an angular upload library (https://github.com/nervgh/angular-file-upload)
UploadController.$inject = ['$scope', 'FileUploader'];
/**
* @namespace UploadController
*/
function UploadController($scope, FileUploader) {
$scope.uploader = new FileUploader();
$scope.uploader.url = 'api/v1/data/import/'
$scope.uploader.method = 'PUT'
};
On the server side the request is making it the right method in the View class
class FileUploadView(views.APIView):
parser_classes = (FileUploadParser,)
def put(self, request, format=None):
file_obj = request.FILES['file']
# ...
# do some staff with uploaded file
# ...
return Response(status=204)
However the Dict that is created is empty
request.FILES['file']
(Pdb) *** django.utils.datastructures.MultiValueDictKeyError: "'file'"
It looks like there is parse exceptions built into the FileUploadParser that are not being run and that I am sending the right type of request over the wire. Why isnt there a way to tell why this request is not being parsed correctly? What am I missing?