Wednesday, July 18, 2012

Re: SuspiciousOperation exception on ImageField upload

But i want to upload to following path..

/usr/local/apache2/htdocs/goibibo/travelibibo/static/refundsReports/%Y%m%d

And the first back slash is must. I can't remove that. So please let me know how can i handle this case.

Thanks,
Binny


On Tuesday, August 19, 2008 6:17:16 PM UTC+5:30, Jon Atkinson wrote:
Hello,

I'm trying to work with a model which accepts a logo image upload via
an ImageField. My a cut down version of my model is below:

class Promoter(models.Model):
        name = models.CharField(max_length=100)
        logo = models.ImageField(upload_to="/images/promoters/%Y/%m/%d/")

When I try to upload the logo via the built-in admin interface, I get
the following error:

SuspiciousOperation at /admin/promoters/promoter/add/
Attempted access to '/images/promoters/2008/08/19/kitten.jpg' denied.

In settings.py, my MEDIA_ROOT is set to an accessible directory in my
home folder: '/home/username/projectname/media/', and this folder has
it's permissions set to 777.

I'm currently using the ./manage.py webserver, which (I assume) runs
as the same user which starts the process; this is the same user as
owns the folder specified above.

Any ideas what I'm doing wrong here?

--Jon

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/5DiLmGCf_E0J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment