Filesystemstorage Django

[Solved] Filesystemstorage Django | Shell - Code Explorer | yomemimo.com
Question : FileSystemStorage django

Answered by : daramola-afeez

if request.method == "POST": # if the post request has a file under the input name 'document', then save the file. request_file = request.FILES['document'] if 'document' in request.FILES else None if request_file: # save attached file # create a new instance of FileSystemStorage fs = FileSystemStorage() file = fs.save(request_file.name, request_file) # the fileurl variable now contains the url to the file. This can be used to serve the file when needed. fileurl = fs.url(file)
return render(request, "template.html")

Source : https://www.geeksforgeeks.org/django-upload-files-with-filesystemstorage/ | Last Update : Sat, 16 Jul 22

Answers related to filesystemstorage django

Code Explorer Popular Question For Shell