File Storage Django

[Solved] File Storage Django | Shell - Code Explorer | yomemimo.com
Question : file storage django

Answered by : aniekutmfon-godwin

from django.shortcuts import render
from django.core.files.storage import FileSystemStorage
def image_upload(request): if request.method == "POST" and request.FILES["image_file"]: image_file = request.FILES["image_file"] fs = FileSystemStorage() filename = fs.save(image_file.name, image_file) image_url = fs.url(filename) print(image_url) return render(request, "upload.html", { "image_url": image_url }) return render(request, "upload.html")

Source : https://testdriven.io/blog/dockerizing-django-with-postgres-gunicorn-and-nginx/ | Last Update : Mon, 14 Mar 22

Question : how to get local storage value in django

Answered by : mominiqbal1234

# In Javascript set your cookie
var value = "mefiz.com";
document.cookie="mefiz="+value;
# Then in Django Views use it
key = request.COOKIES.get('mefiz')
image.mefiz.com
https://github.com/MominIqbal-1234

Source : | Last Update : Tue, 17 Oct 23

Answers related to file storage django

Code Explorer Popular Question For Shell