CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Inserting an Image in MSSQL using CodeCharge

Print topic Send  topic

Author Message
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.

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.