In the grand scheme I want to store images in a field in my my sql database.
I have an 'add' page which has a form in it , one of the filed allows me select a file from my hard drive. I have named the field nu_userfile- thus giving this file location the variable name $nu_usefile.
I then 'process' $nu_userfile like this
$imagedata2 = addslashes(fread(fopen($nu_userfile, "r")));
I then 'insert' $imagedata2 into my database- and it is mi binary file.
So far so good this all works. I can add and view the graphic in the appropraite records (I also have 4 other fileds including id, date, title and description)
The problem arises on my 'edit' page where I want to update the fields. I have another form which 'inserts' the updated information into the database. This all seems to work for my text fileds, but my image updating seems to fail with this line
$imagedata2 = addslashes(fread(fopen($nu_userfile, "r")));
even though it worked perfectly in the add page.
Breaking it down in error checking, I have echo'ed the various elements
$nu_userfile echo as C:\file.gif (or whatever), but $imagadata2 comes out as blank. So it seems to fail at the fopen or fread stage. But I cant see why as the same line works elsewhere
any help is much appreciated as it is doing my head in
thanks in advance