Opened 8 years ago

Closed 8 years ago

#15986 closed Uncategorized (invalid)

Image upload from another website using image url

Reported by: assomy@… Owned by: nobody
Component: Uncategorized Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


want to make an image uploader using images links on the internet (eq: The user writes the previous url and then my model upload it.

This my code:


<input id="id_name" type="text" name="name" maxlength="255" value="" />

def Post_date():

if request.method == 'POST':

form = Addpic()#simple form to capture data
image_url = request.POST.get('image')
file = urllib.urlopen(image_url)
im = cStringIO.StringIO( # constructs a StringIO holding the image
img =
save = '/tmp/' + str(int(time.time())) + '.gif'

if form.is_valid():

pic =

class Pic(models.Model):

image = ImageWithThumbsField(upload_to='images', sizes=((128, 128),))

The image uploads but if form.is_valid(): doesn't work and I don't know how to add it to the form data. how i can assign the downloaded image to my form (form.image=save)?

Change History (1)

comment:1 Changed 8 years ago by Russell Keith-Magee

Resolution: invalid
Status: newclosed

Trac isn't for answering "how do I' questions -- it's for tracking bugs in Django.

If you want to ask a "how do I" question, please ask on the django-users mailing list, or on the #django IRC channel

Note: See TracTickets for help on using tickets.
Back to Top