Ok I understood. You can use SimpleUploadedFile as follows:
if request.method == 'POST': from django.core.files.uploadedfile import SimpleUploadedFile object = Model.objects.get(pk=1) file_contents = SimpleUploadedFile("%s.mp3" % "myfile", request.raw_post_data, "audio/mp3") object.audio.save("%s.mp3" % "myfile", upfile, True)
source share