def _make_swf(file): buffer = StringIO() for chunk in file.chunks(): buffer.write(chunk) buffer.reset() file = File(type='application_swf') file.file.put(buffer, content_type='application/x-shockwave-flash') file.transformation = 'main.swf' file.save() return file
def audio_file(name, description): buffer = StringIO() for chunk in request.FILES['file'].chunks(): buffer.write(chunk) buffer.reset() file = File(type='library_audio') file.file.put(buffer, content_type='audio/mpeg') file.transformation = 'main.mp3' file.name = name file.description = description return file.save()