Cloudinary upload (docx, .xls) in the Django admin
hi,
I'm using the cloudinary.com File upload the files .
In the Admin I am using :
from cloudinary.models import CloudinaryField
...
...
file = CloudinaryField("Arquivo", null=True, blank=False)
But I can only upload images and .pdf files when I try to upload other ex formats : .doc .txt throws an exception
Django Version: 1.7.5
Exception Type: Error
Exception Value:
Invalid image file
Exception Location: C:\Python27\Lib\site-packages\cloudinary\uploader.py in call_api, line 223
Thanks
-
Hi,
The 'resource_type' parameter is defaulted to "image".
You should define it as either "raw" or "auto" in order to be able to upload non-images files (PDF is can be uploaded as both types).1 -
HI thanks for the reply.
But I am still having trouble , now no longer throws the exception but the file will not to the server.
class MyCloudinaryField(CloudinaryField):
def upload_options(self, model_instance): #print model_instance.file return {"resource_type": "raw"}
Link file:
http://res.cloudinary.com/sbtur-com/image/upload/v1430144743/vsuudo0cvl1ojzlflegp.xlsx0 -
Can you share with us your whole Upload code?
If you don't want to make it public you are welcome to open a support ticket and we'll help you troubleshoot this issue.
http://support.cloudinary.com/tickets/new
Nadav
0
Post is closed for comments.
Comments
3 comments