Questions tagged [django-file-upload]

Django-file-upload refers to how django handles file uploads

Django-file-upload refers to how django handles file uploads.

See documentation.

325 questions
0
votes
1 answer

How can my users delete a file that they uploaded using latest Django version?

I'm not getting an error message---but when the Delete button is pressed in my template, nothing happens. Does anyone see what's missing in my code below? settings.py MEDIA_URL = '/home/' MEDIA_ROOT = os.path.join(os.path.dirname(BASE_DIR), …
Condado
  • 83
  • 7
0
votes
2 answers

How to convert bytes into a file the user can download in Django?

I have the bytes of a file saved in my Django database. I want users to be able to download this file. My question is how do I convert bytes into an actual downloadable file. I know the file name, size, bytes, type and pretty much everything I need…
user19661285
0
votes
1 answer

How to save an object with image from views.py in django

In my django project I have to save an image from views.py to the database here is my models.py class Mymodel(models.Model): id=models.IntegerField(unique=True,primary_key=True) name=models.CharField(max_length=20,unique=True) …
0
votes
0 answers

how to send image file with json request?

I am working on an e-commerce project, and I want to add products from the front end. The files in my product app in Django is as follows this is my model.py: class Product(models.Model): pub_date =…
0
votes
1 answer

Django : transform a function download view into a class view

I am trying to rewrite a function view that download files into a classview. However I don't see how to do it properly with the right methods, since I have an argument from the url. Then I do not which on of the class view I should be using. I did…
0
votes
0 answers

How to restrict access to a media-File in Django?

I've an application where my users create a video-file (mp4) which is saved as a Filefield in the model. In my view I add the object (model) to the context of a TemplateView class. In my HTML I use the video tag and use the "src" to add the url and…
0
votes
0 answers

Is it possible to edit HTML for Django FileResponse via template or view?

I've an application that allows users to add a video. This video is an MP4 format and saved via a FileField to the model. I want to play the video via a fileResponse (view). This FileResponse plays the video in an html. I would like to customize the…
0
votes
1 answer

File uploaded in my form is not showing up in my edit/update form

When I fill out my form with its file, it apparently submits, but when checking it out when editing/uploading, all data in the form shows up except my file. So, I cannot access it at all. I guess it probably has something to do with my views.py (the…
0
votes
1 answer

Django Files Upload from Form get CSRF Forbidden on production

I have a simple Django FileForm for multiple files upload (basically txts with polygon coordinates). I don't want to save the uploaded files anywhere but only treat them on the fly (memory?) and return a leaflet map with the polygons and a new file…
0
votes
1 answer

Is there a way to use files uploaded in django in the template?

I have a django model form where I uploaded images for my app. I am just storing them temporarily locally since its not a real project. The Admin looks like this I'm wondering if there is a way to use the images uploaded with each object in the…
0
votes
1 answer

Django simple upload function

Getting this error: Exception Type: AttributeError Exception Value: 'InMemoryUploadedFile' object has no attribute 'save' When trying to have a Django function as simple as: def upload(request): file = request.FILES["picture"] …
0
votes
1 answer

How to store images using Django forms?

I'm new to django. I've been stuck for a while. I believe everything is configured correctly. However, when my objects are created it is not creating the media directory or storing the files/images. I have done the settings file, urls, views,…
0
votes
1 answer

Django file/image upload not responding

I've gone through about 8 tutorials across YouTube and Online websites. I believe everything is configured correctly. However, when my objects are created it is not creating the media directory or storing the files. I have done the settings file,…
0
votes
1 answer

Django - media files - security

I created a Django app with Video files. I'm using Gunicorn & Nginx. A user (not root) that runs the django server. I restricted the views so only the users with correct permissions can view these. This works fine. But when watching a video, I can…
0
votes
1 answer

Django : customizing FileField's current file in templates

I am rendering a simple form with a file field. class ReviewForm(forms.ModelForm): class Meta: model = Review fields = [ 'file', ] widgets = { 'file': forms.ClearableFileInput(), …