Does django-unicorn support file uploads #729
Unanswered
nyashaChiza
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Hello @nyashaChiza, thanks for the question! File upload support has never been added to |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Question: Does Django-Unicorn Support File Uploads?
I'm currently working on a Django project where I'm using Django-Unicorn for a reactive front-end. I need to implement file uploads as part of my component's functionality, specifically to handle image uploads for steganography encoding.
I've set up a form using the standard
<input type="file" unicorn:model="cover_image" />
, but I'm running into issues where the file is being passed as a string (with a fake path likeC:\fakepath\filename.png
) instead of anInMemoryUploadedFile
object or similar file-like object that I can work with on the server side.Here's a brief overview of my setup:
HTML Template:
Unicorn Component:
Issue:
When I submit the form,
cover_image
is passed as a string path rather than an actual file object. This string is often something like"C:\fakepath\filename.png"
, which is not the real file path and is unusable in the back-end. I need to know how to properly handle file uploads in Django-Unicorn to get anInMemoryUploadedFile
or similar object that I can work with.Questions:
InMemoryUploadedFile
or similar in the Unicorn view?Any guidance or examples would be greatly appreciated.
Beta Was this translation helpful? Give feedback.
All reactions