Re: Image Upload question
The problem was no PIL and libjpeg... On Sep 23, 2:43 pm, Joel Klabo wrote: > from the django docs: > > inherits all attributes and methods from FileField, but also validates > that the uploaded object is a VALID IMAGE. > > what does valid image mean? > > On Sep 23, 2:40 pm, Joel Klabo wrote: > > > > > Thanks, upload is now working. But, only for smallish .png files, what > > are the constraints on file type and size django sets? I can't find > > the information anywhere? Beyond that, can I set them myself? > > > On Sep 23, 1:41 pm, Peter Bengtsson wrote: > > > > By being bound it means that you will have run the .is_valid() method > > > of the form instance once you've instanciated it with your POST and > > > FILES data. > > > E.g. > > > form = BrewImageFrom(data=request.POST, files=request.FILES) > > > if form.is_valid(): > > > brewimage = form.save() > > > > On Sep 23, 3:00 pm, Joel Klabo wrote: > > > > > I have a form trying to upload an image. In the docs it says that the > > > > form must be bound to save a file. This is an issue for me because I > > > > wan't to save the file with other data such as the User object that > > > > saved it. I can't put a User object in a form so I put the username in > > > > a hidden form field which allows me to find the user in the view and > > > > use it. But, I can't bind the form with data not from POST right? I > > > > need to do request.FILES, in combination with data not coming from > > > > post. I'm obviously confused I would appreciate some guidance here > > > > > Here's the code:http://gist.github.com/594136 -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Image Upload question
from the django docs: inherits all attributes and methods from FileField, but also validates that the uploaded object is a VALID IMAGE. what does valid image mean? On Sep 23, 2:40 pm, Joel Klabo wrote: > Thanks, upload is now working. But, only for smallish .png files, what > are the constraints on file type and size django sets? I can't find > the information anywhere? Beyond that, can I set them myself? > > On Sep 23, 1:41 pm, Peter Bengtsson wrote: > > > > > By being bound it means that you will have run the .is_valid() method > > of the form instance once you've instanciated it with your POST and > > FILES data. > > E.g. > > form = BrewImageFrom(data=request.POST, files=request.FILES) > > if form.is_valid(): > > brewimage = form.save() > > > On Sep 23, 3:00 pm, Joel Klabo wrote: > > > > I have a form trying to upload an image. In the docs it says that the > > > form must be bound to save a file. This is an issue for me because I > > > wan't to save the file with other data such as the User object that > > > saved it. I can't put a User object in a form so I put the username in > > > a hidden form field which allows me to find the user in the view and > > > use it. But, I can't bind the form with data not from POST right? I > > > need to do request.FILES, in combination with data not coming from > > > post. I'm obviously confused I would appreciate some guidance here > > > > Here's the code:http://gist.github.com/594136 -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Image Upload question
Thanks, upload is now working. But, only for smallish .png files, what are the constraints on file type and size django sets? I can't find the information anywhere? Beyond that, can I set them myself? On Sep 23, 1:41 pm, Peter Bengtsson wrote: > By being bound it means that you will have run the .is_valid() method > of the form instance once you've instanciated it with your POST and > FILES data. > E.g. > form = BrewImageFrom(data=request.POST, files=request.FILES) > if form.is_valid(): > brewimage = form.save() > > On Sep 23, 3:00 pm, Joel Klabo wrote: > > > > > I have a form trying to upload an image. In the docs it says that the > > form must be bound to save a file. This is an issue for me because I > > wan't to save the file with other data such as the User object that > > saved it. I can't put a User object in a form so I put the username in > > a hidden form field which allows me to find the user in the view and > > use it. But, I can't bind the form with data not from POST right? I > > need to do request.FILES, in combination with data not coming from > > post. I'm obviously confused I would appreciate some guidance here > > > Here's the code:http://gist.github.com/594136 -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Image Upload question
By being bound it means that you will have run the .is_valid() method of the form instance once you've instanciated it with your POST and FILES data. E.g. form = BrewImageFrom(data=request.POST, files=request.FILES) if form.is_valid(): brewimage = form.save() On Sep 23, 3:00 pm, Joel Klabo wrote: > I have a form trying to upload an image. In the docs it says that the > form must be bound to save a file. This is an issue for me because I > wan't to save the file with other data such as the User object that > saved it. I can't put a User object in a form so I put the username in > a hidden form field which allows me to find the user in the view and > use it. But, I can't bind the form with data not from POST right? I > need to do request.FILES, in combination with data not coming from > post. I'm obviously confused I would appreciate some guidance here > > Here's the code:http://gist.github.com/594136 -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.