The reason I'm POSTing after the direct upload to S3 I need to create the model with extra data. As far as I can tell S3's success_action_redirect doesn't allow you to pass additional information.
Additionally, since this is an ImageField, I can't set the key directly. At the moment, I've resorted to Raw SQL :( What have I missed? On Jan 1, 3:45 pm, Ivo Brodien <i...@brodien.de> wrote: > Hi, > > the form sends the picture to S3 and then S3 calls you on an URL which you > specify with “ success_action_redirect”. This should point to an URL on your > server where you then store the key/hash which will be provided in the URL. > > Your code uses POST data but S3 will put the metadata in the URL (=GET) > (bucket, key and etag) > > So just make sure that your forms posts to S3 and you define the > success_action_redirect URL. > > I think you actually don’t need the S3StorageBackend since you are not > storing anything or at least it does not actually pass your server. > > hope that helps! > > Cheers > Ivo > > On Jan 1, 2012, at 12:25 , Chris Hasenpflug wrote: > > > > > > > > > I have a model with an ImageField and am using django-storages > > S3BotoStorage backend. To reduce load on the server, I'm using > > Amazon's S3 Browser Upload functionality[1] to send images directly to > > S3. In order to create the model, my plan is have another view take > > the uploaded key and save a model instance of my image. Currently my > > view code looks something like this: > > > def add_existing_image(request): > > ... > > image_key = request.POST.get('image_key', None) > > im = default_storage.open(image_key) > > i = Image(image=im, owner=user) > > > However, this seems to re-save the image on S3. I was hoping that > > since I'm not directly reading the file it would not need to do so > > behind the scenes, but it is. Since the goal is to not incur that > > overhead, how should I go about creating model instances of these > > files that already exist in my storage? > > > [1]http://aws.amazon.com/articles/1434 > > > -- > > 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 > > athttp://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.