File Description: File to upload/store in database:"> File Description: File to upload/store in database:" />
扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
// 如果提交了表单,代码将被执行:
dl("php_oci8.dll");
$conn = OCILogon("scott","tiger");
if ($submit) {
echo "File name: $userfile_name
";
echo "File size: $userfile_size
";
$hwsize = GetImageSize($userfile );
$w = $hwsize[0];
$h = $hwsize[1];
echo "Image width: $w
";
echo "Image height: $h
";
$ImgType = strtolower(substr( strrchr( $userfile_name, "." ), 1 ) );
if ($ImgType == "jpg")
$ImgType = "jpeg";
echo "Image type: $ImgType
";
echo "Created date; ".date("Y-m-d")."
";
$sql = "insert into
Picture (PicId, UserName, Width, Height, ImgSize, ImgType, Created, Image, FileName, Description)
values(PicturePicId.nextval, "$username", $w, $h, "$userfile_size", "$ImgType", TO_DATE("".date("Y-m-d")."","YYYY-MM-DD"), EMPTY_BLOB(), "$userfile_name", "$description")
returning Image into :Image";
echo "
$sql";
}
?>
//display.php
/*
Purpose:
Display an image from "Picture" table
*/
dl("php_oci8.dll");
$conn = OCILogon("scott","tiger");
$stmt = OCIParse($conn, "select Image, ImgType from Picture where picid=23" );
OCIExecute($stmt);
@OCIFetchInto($stmt, &$result, OCI_ASSOC);
Header("Content-type: image/".$result["IMGTYPE"]);
echo $result["IMAGE"]->load();
OCILogoff($conn );
?>
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者