ImageField uses PIL (Python Imaging Library) to verify if it's a valid
image, if I understand it correctly.

On Thu, Oct 6, 2011 at 6:21 PM, Ian <icinna...@gmail.com> wrote:

> Ah! Got it working! How do I make sure the files are only images?  Is
> there a way to check the extension?  Also, how would I rename the
> file?
>
> Thanks!
>
> On Oct 6, 3:46 pm, bazaarsoft <jay_mar...@me.com> wrote:
> > Noticed a couple of typos in my reply:
> >
> > > I have "MEDIA_ROOT = '/Users/storefiles/' in my settings.py folder,
> >
> > file, not folder
> >
> > > and the upload_to param in my model set to 'pluginFiles/%Y/%m/%H/%M/'.
> >
> > is actually 'pluginFiles/%Y/%m/%d/%H/%M/'
> >
> > jay
> >
> > On Oct 6, 2:41 pm, bazaarsoft <jay_mar...@me.com> wrote:
> >
> >
> >
> >
> >
> >
> >
> > > > Also, I'm confused whether upload_to should be set in settings.py or
> > > > models.py
> >
> > > It's actually a mix - if you have MEDIA_ROOT defined in settings.py,
> > > then it will use that as the first part of the path. Then, what you
> > > pass in the upload_to field will be appended to that. So, in my case,
> > > I have "MEDIA_ROOT = '/Users/storefiles/' in my settings.py folder,
> > > and the upload_to param in my model set to 'pluginFiles/%Y/%m/%H/%M/'.
> > > What ultimately happens, then, is that the file gets stored here:
> >
> > > /Users/storefiles/pluginfiles/2011/10/06/02/38/somefile.zip
> >
> > > So, you must have at least one of those set and the path must be fully
> > > write enabled for whatever process is running your Django app. For my
> > > testing, I just made /Users/storefiles writable by everyone since I
> > > don't really care about securing that directory on my dev Mac.
> >
> > > jay
> >
> > > On Oct 6, 1:08 pm, Ian <icinna...@gmail.com> wrote:
> >
> > > > I can't seem to get it working.  It won't let my sync the database
> > > > with this code:
> > > > image = ImageField(upload_to=None[, max_length=100, **options])
> >
> > > > Also, I'm confused whether upload_to should be set in settings.py or
> > > > models.py
> >
> > > > Thanks!
> >
> > > > On Oct 6, 6:11 am, BILLION Sébastien <sebastien.bill...@gmail.com>
> > > > wrote:
> >
> > > > > Hi,
> >
> > > > >
> http://www.nitinh.com/2009/02/django-example-filefield-and-imagefield/
> >
> > > > > It the same for ImageField
> >
> > > > > BILLION S�bastien
> >
> > > > > the Answer to the ultimate question of life, the universe and
> everything
> > > > > is 42
> >
> > > > >http://www.sebastienbillion.com/<http://www.sebastienbillion.com/>
> >
> > > > > Le 06/10/2011 05:22, Ian a �crit :
> >
> > > > > > Hey Everyone,
> >
> > > > > > I'm new to django, but I love it so far!
> >
> > > > > > I'm trying to figure out how to upload an image (restrict it to
> images
> > > > > > only) and resave it as a different name.
> > > > > > Eventually, I'll want to upload it to S3, but for now, I'm just
> > > > > > testing it on my computer with runserver (so I'm not sure where
> it
> > > > > > should be saving it).
> >
> > > > > > There are hundreds of tutorials for this online, but they are
> either
> > > > > > outdated or more complex than I'm looking for.
> >
> > > > > > Right now, I have a template with the form in it.  I'm not sure
> where
> > > > > > to go from there.
> >
> > > > > > Thanks so much!
> > > > > > Sorry if this question is too basic!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@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.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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.

Reply via email to