Just to let everyone know, the user must have their FILE permission in the MySQL authentication tables set to Y.
Thank you to Paul DuBois for pointing this out to me. :) Kevin ----- Original Message ----- From: "Paul DuBois" <[EMAIL PROTECTED]> To: "Kevin Smith" <[EMAIL PROTECTED]> Cc: < Sent: Friday, February 01, 2002 5:57 PM Subject: Re: LOAD_FILE over SMB filesystems > At 17:47 +0000 2/1/02, Kevin Smith wrote: > >I don't get an error message... I'm actually running the script from the > >shell > prompt, so I'm totally mystified about why it's not working. > > Umm, actually it is working, according to the trace below. execute() > returns "0E0", which means the statement succeeded and update 0 rows. > (Otherwise you'd get back under or the DBI would throw an exception, > depending on whether you have RaiseError enabled.) > > So, either: > - no row has an id value of 1, or > - the row with an id value of 1 already has the exactly same image value, > in which case MySQL knows that it's not actually changing the current > value, and reports "no rows changed". > > Assuming you have a row with id = 1, clear out the existing image > value manually: UPDATE banners SET image = '' WHERE id = 1; > > Then try your script ag'in and see what happens. > > > > >Here is the DBI debug : > > > >[root@server1 cgi-bin]# perl blob.cgi > > DBI::db=HASH(0x81b34a0) trace level set to 2 in DBI 1.14-nothread > > Note: perl is running without the recommended perl -w option > > -> prepare for DBD::mysql::db (DBI::db=HASH(0x81b34b8)~0x81b34a0 'UPDATE > >banners SET banners.image = > >LOAD_FILE('/var/www/htdocs/corporate/images/homenew.jpg') where > >banners.id=1') > >Setting mysql_use_result to 0 > > <- prepare= DBI::st=HASH(0x8196e48) at blob.cgi line 17. > > -> trace in DBD::_::common for DBD::mysql::st > >(DBI::st=HASH(0x8196e48)~0x81bcd04 2) > > <- trace= 2 at blob.cgi line 18. > > -> execute for DBD::mysql::st (DBI::st=HASH(0x8196e48)~0x81bcd04) > > -> dbd_st_execute for 081bccf8 > > <- dbd_st_execute 0 rows > > <- execute= '0E0' at blob.cgi line 20. > > -> finish for DBD::mysql::st (DBI::st=HASH(0x8196e48)~0x81bcd04) > > <- finish= 1 at blob.cgi line 25. > > -> disconnect for DBD::mysql::db (DBI::db=HASH(0x81b34b8)~0x81b34a0) > >imp_dbh->svsock: 8150e5c > > <- disconnect= 1 at blob.cgi line 26. > > -> DESTROY for DBD::mysql::st (DBI::st=HASH(0x81bcd04)~INNER) > > <- DESTROY= undef during global destruction. > > -> DESTROY for DBD::mysql::db (DBI::db=HASH(0x81b34a0)~INNER) > > <- DESTROY= undef during global destruction. > > > >----- Original Message ----- > >From: "Paul DuBois" <[EMAIL PROTECTED]> > >To: "Kevin Smith" <[EMAIL PROTECTED]> > >Cc: <[EMAIL PROTECTED]> > >Sent: Friday, February 01, 2002 5:43 PM > >Subject: Re: LOAD_FILE over SMB filesystems > > > > > >> At 17:41 +0000 2/1/02, Kevin Smith wrote: > >> >Yes, it definitely is... I'm running Apache 1.3.22 on Linux RedHat 7.1 > >and > >> >MySQL 3.23.47. > >> > >> Does the script connect to the MySQL server using a MySQL account > >> that has the FILE privilege? > >> > >> By the way, you didn't report the error message that you get. > >> What is it? > >> > >> > > >> >----- Original Message ----- > >> >From: "Paul DuBois" <[EMAIL PROTECTED]> > >> >To: "Gerald Clark" <[EMAIL PROTECTED]>; "Kevin Smith" > >> ><[EMAIL PROTECTED]> > >> >Cc: <[EMAIL PROTECTED]> > >> >Sent: Friday, February 01, 2002 5:37 PM > >> >Subject: Re: LOAD_FILE over SMB filesystems > >> > > >> > > >> >> At 11:32 -0600 2/1/02, Gerald Clark wrote: > >> >> >The single quotes around $image prevent perl from substituting the > >value. > >> >> >You are trying to load a file named $imageFN. > >> >> >$SQL = "UPDATE banners SET image=load_file(\"$imageFN\") where id=1"; > >> >> > >> >> But the single quotes are within a double-quoted string. So shouldn't > >> >> the substitution still occur? > >> >> > >> >> Is the web server running on the same host as the MySQL server? > >> >> > >> >> > > >> >> >Kevin Smith wrote: > >> >> > > >> >> >>After reading some other posts on inserting a image into a blob > >field, I > >> >> >>tried using DBI to insert and the following does not work... > >> >> >> > >> >> >>I've double-checked the path and it is correct. > >> >> >> > >> >> >>$imageFN = '/var/www/htdocs/corporate/images/homenew.jpg'; > >> >> >>$SQL = "UPDATE banners SET image=load_file('$imageFN') where id=1"; > >> >> >> > >> >> >>If I execute the same SQL statement at the MySQL > prompt it inserts > >> >into > >> >> >>the database fine... what am I doing wrong? > > > >> >> > >> >> >>Thanks, > >> >> >> > >> > > >>Kevin > >> > >> > >> > > > --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php