插入 MS-SQL 2008 数据库
<cffile action="READBINARY" file="#form.FileContents#" variable="binPDF">
<cfquery name="Uploaded" datasource="#cfbasedatasource#">
INSERT INTO UploadedFiles
(
AccountId,
Filecontent
)
VALUES
(
'#UrlAccountId#',
<cfqueryparam value='#binPDF#' cfsqltype='cf_sql_blob'>
)
</cfquery>
========================= 这是从数据库到浏览器的显示:
<cfset binaryData = #cfGetfilecontentquery.Filecontent[1]#>
<cfheader name="Content-Disposition" value="inline; filename=testDocument.pdf">
<cfcontent variable="#binarydata#" type="application/pdf" reset="yes" />
但我只能在浏览器中看到“加载 PDF 文档失败”