-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple image upload at once #1419
Comments
Answered on SO. |
Do i have to create a separate table for image and link that with the Rental Table?Sorry i did not get your reply on SO , so i am asking over here. |
If i remove the deserialize part i get an error saying error_message: "The format indicated 'multipart/form-data |
Yes, you'll need the images on another table. You'll still need your custom deserialize method there to handle the multipart/form-data, which isn't normally supported by tastypie. REST APIs, and especially tastypie, tend not to handle file uploads well. What I usually do is write a view that accepts file uploads and stores them in a temporary location (something that can be cleaned out regularly via a cron job) and returns a path to that file within the Django storage class used. Then, to add that file to a model, you send the storage path along in a regular JSON request, and on your resource move/copy the file from the temp location to the permanent location. |
It seems so complex.I think i should not go with tastypie for handling multiple image upload. |
If you want the easiest way to upload files via tastypie, there are recipes out there for base64 encoding your files and putting them in the JSON. It makes your JSON really hard to read though. |
I am having trouble at uploading multiple image at once.On console i see all the images but only last image is stored on the tastypie.I have also aksed a question on stack overflow but still did not get any solution on this issue.
http://stackoverflow.com/questions/34850160/react-dropzone-multiple-image-at-once-in-tastypie?noredirect=1#comment57445055_34850160
The text was updated successfully, but these errors were encountered: