using django requests, I am trying to get the absolute file path of original, uploaded file. The reason is I want to modify the original file so just the filename or some "media root" location just isn't enough.
I tried doing something like
request.FILES['file'].name
but that just gives me the name, not a path (neither absolute nor relative). google didn't really help, filenames are common, but path seems to be a special case. I hope it's even possible XP.
Thx in advance!
Try this.
myfile = request.FILES['filename']
fs = FileSystemStorage()
filename = fs.save(myfile.name, myfile)
uploaded_file_url = fs.url(filename)
print(uploaded_file_url)
Also make sure you add the 'django.core.files.storage.FileSystemStorage' under Middleware_classes in settings.py file