How to store a file on a server(web container) through a Java EE web application?

By spec, the only “real” path you are guaranteed to get form a servlet container is a temp directory. You can get that via the ServletContext.gerAttribute(“javax.servlet.context.tempdir”). However, these files are not visible to the web context (i.e. you can not publish a simple URL to deliver those files), and the files are not guaranteed in … Read more

How to copy InMemoryUploadedFile object to disk

This is similar question, it might help. import os from django.core.files.storage import default_storage from django.core.files.base import ContentFile from django.conf import settings data = request.FILES[‘image’] # or self.files[‘image’] in your form path = default_storage.save(‘tmp/somename.mp3’, ContentFile(data.read())) tmp_file = os.path.join(settings.MEDIA_ROOT, path)