Hi Brian, Something like this should work for you:
if form.is_valid(): photo = Photo() photo.save_source_file(form.cleaned_data['source'].filename, form.cleaned_data['source'].content) # redirect/etc Hth, Aaron brianmac wrote: > For the life of me I can't get django to upload a file. > I have all of the settings correct, PIL installed and correct enctype. > > My model is as follows: > > class Photo(models.Model): > source = models.ImageField(upload_to='images') > > Then in my view I try: > > Photo(request.FILES).save # I receive and Index error. > > Photo(request.POST, request.FILES).save # I receive and Index error. > > Photo(source = request.FILES).save # I receive and Index error. > > Photo(source = request.FILES['image']).save # puts dictionary(ie: > {'content':<omitted>,'file-type':...) in db and does not upload file > > Also the model works when I use the admin interface. > > Any Ideas? > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---