List:General Discussion« Previous MessageNext Message »
From:João Cândido de Souza Neto Date:October 15 2009 7:12pm
Subject:Re: Inserting an Image
View as plain text  
data in a mysql table field", the best way is to save the file in your file 
system and the file name in the table field, but, if you like to do that, 

"Victor Subervi" <victorsubervi@stripped> escreveu na mensagem 
news:4dc0cfea0910151204m783904b3uaae1467931a3074a@ style="color:#666">stripped...
> Hi;
> I have successfully inserted images, like yesterday, before into MySQL 
> with
> the following code:
>
>      sql = 'update productsX set pic1="%s" where ID=2;' % pic1
>      cursor.execute(sql)
> where pic1 is simply an image uploaded through a form then sent over 
> without
> any alteration to another (python) script that uploads it.  Printing it 
> out
> looks like this (other variables included):
>
> update productsX set Name=%s, Title=%s, Description=%s, Price=%s,
> Bedrooms=%s, Bathrooms=%s, Conditions=%s, Acreage=%s, Construction=%s,
> Location=%s, Estate=%s, Address=%s, Furnished=%s, pic1=%s, pic2=%s, 
> pic3=%s,
> pic4=%s, pic5=%s, pic6=%s where ID=%s;', ('name1', 'title1', 'descr1',
> '1.1', '2', '1', 'New', '1.5', 'New', 'arbor', 'abor', 'abor', 
> 'Furnished',
> "qs
> :z]ƦM
> '',
> '', '', '', '')
>
> MySQL complains about the image in string form. I'm sure the solution is
> simple, but I don't know what it is.
> TIA,
> Victor
> 


Thread
Inserting an ImageVictor Subervi15 Oct
  • Re: Inserting an Imagejoao15 Oct
  • RE: Inserting an ImageGavin Towey15 Oct
    • Re: Inserting an ImageMichael Dykman15 Oct
      • Re: Inserting an ImageVictor Subervi16 Oct