Join the Stack Overflow Community
Stack Overflow is a community of 6.7 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

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?

share|improve this question
    
send JSON toy preserve types, POST is all strings – dandavis Sep 17 '14 at 20:43
    
But this _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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.