On Thu, Jun 26, 2014 at 10:58 AM, Bobby Gulshan <[email protected]> wrote: > No errors when hitting upload. But the image doesn't appear where I have > indicated it ought to. Put an absolute path in MEDIA_ROOT and referenced the > same in (upload_to) param ImageField. Not sure what I am missing. > > Model: > > class FileUploadHandler(models.Model): > title = models.CharField(max_length=100) > file = > models.ImageField(upload_to='/Python27/Lib/site-packages/django/bin/mideastinfo/wiki/static/')
Your upload_to path looks like an absolute directory, which means that Django will attempt to store the file in that subdirectory of the path you've configured for MEDIA_ROOT. https://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.FileField.storage You want to do like Mario suggested and set 'upload_to' to a relative path from the MEDIA_ROOT where you want images for that model stored. -- Darren Spruell [email protected] > View: > > from models import Article, Edit > from forms import ArticleForm, EditForm > from forms import * > from PIL import Image > from models import FileUploadHandler > > def image_upload(request): > if request.method == 'POST': > form = UploadImageForm(request.POST, request.FILES) > if form.is_valid(): > FileUploadHandler(request.FILES['image']) > return render_to_response('wiki/gallery.html') > else: > form = UploadImageForm() > return render_to_response('wiki/gallery.html', > RequestContext(request, {'form': form})) > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/29eff052-3181-4e0d-80fc-84fffe6ba029%40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAKVSOJUcPmRRsMXFcYkRje9w8x6ZbO0AxmoOez29q7AhWyeB8g%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

