Lee Irving
|
| Posted: 01/31/2005, 3:33 AM |
|
I have seen a few people trying to accomplish this and thought I'd share how I had done it. It still requires you to upload the file to the server and then this is loaded into he image field.
If anyone has a better way i will be glad to listen ;)
The form is tblUser and has a working file upload control which loads the file into c:\IMGTEMP which is then read into the database.
The following is inserted in the tblUser_Signature_AfterProcessFile
(signature being the file upload control)
global $tblUser;
$upfile = $tblUser->Signature->Value;
$datastring = file_get_contents("c:\\IMGTemp\\". $upfile);
$data = unpack("H*hex", $datastring);
$user = CCGetUserID();
$SQL= "update tblUser set Signature = 0x" . $data['hex'] . " where UserID = " . userid;
$db = new clsDBMGS();
$db->query($SQL);
$db->close();
and in the after delete event I have added the following :
global $tblUser;
$user = CCGetUserID();
$SQL= "update tblUser set Signature = NULL where UserID = " . userid;
$db = new clsDBMGS();
$db->query($SQL);
$db->close();
Hope this is of use to someone
|
|
|
 |
adolfo
|
| Posted: 02/01/2005, 10:00 AM |
|
Lee,
Thank you for your script. I tried making it work with no success. Do you have more detailed step-by-step instructions you could share on how to setup the form, eg. db structure, etc...
Thank you very much.
|
|
|
 |
|