I have been using ng-file-upload to upload files to server. Recently I saw that it is converting payload/data that I am adding to it apart from file from any data type to string only. For example if I am sending integer or boolean field, it is converting it into string. I am using django at backend, so when I print type of request data it is showing unicode and in model I have defined NullBooleanField. Because of this everytime it takes it True and save it in database as True. Below is the little snippet of what I am doing.
var _data = {'name': 'xxx',' good':false};
$scope.upload = $upload.upload({
url: URL,
method: 'PUT',
file: data_file,
data: _data,}).progress(function(evt){
});
each time when I print the type of this at backend
type(print (request.DATA['good'])))
it return
<type 'unicode'>
Am i missing something here or something is actually wrong?
_data
is a JSON. Its seems like this $upload is converting json data into string. (My guess is there internal implementation is like they convert each payload into string and then send it to server.) – Shubham Paramhans Sep 18 '14 at 4:48