Jump to content


New Members
  • Posts

  • Joined

  • Last visited


Profile Information

  • Gender
    Not Telling

wlee345's Achievements


Newbie (1/5)



  1. I try to use the following code to upload a Word document to SQL Server's image column "Document" which can store binary file. define("MAX_SIZE",3000000); $handle = fopen($uploadwordfile, "rb") or die( "Can't open this Word file!" ); $data = base64_encode(fread($handle, MAX_SIZE)); $sql_loadfile = "insert into Media (number, Document) values (1,'".$data."')"; $condata->Execute($sql_loadfile) or die($condata->ErrorMsg()); fclose($handle); $uploadwordfile is the local address of the document file. I try a 3-page text file which is OK but doesn't work for a one-word Word file. It look like the encoded $data is truncated in $sql_loadfile. Anyone can help?
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.