Client Side via curl:
Server side
==>
'DEFAULT_PARSER_CLASSES': (
'rest_framework
)
For your_api
permission_classes = (IsAuthenticated, IsAdminOrReadOnly)
parser_classes = (MultiPartParser,)
# Read uploaded files
my_file = request
temp_file
temp_file
P.S: Please change 'data' to others if you put the different variable name in curl command!!
Reference:
http://stackoverflow.com/questions/21012538/retrieve-json-from-request-files-in-django-without-writing-to-file
If you want to get the content of uploaded file , you can directly use theapi .
.
read ( )
Something like:
if request. FILES. has_key( 'data'):
file = request. Files[ 'data']
data = file. read ( )
#you have file contents in data