Djangoでブラウザからのファイルアップロードを処理するサンプルです。
uploaded_file = request.FILES['file']
file_path = '/tmp/' + uploaded_file.name
with open(file_path, 'wb+') as dest:
for chunk in uploaded_file.chunks():
dest.write(chunk)
Djangoでブラウザからのファイルアップロードを処理するサンプルです。
uploaded_file = request.FILES['file']
file_path = '/tmp/' + uploaded_file.name
with open(file_path, 'wb+') as dest:
for chunk in uploaded_file.chunks():
dest.write(chunk)