本文整理汇总了PHP中DatabaseConnection::updateuploadeddata方法的典型用法代码示例。如果您正苦于以下问题:PHP DatabaseConnection::updateuploadeddata方法的具体用法?PHP DatabaseConnection::updateuploadeddata怎么用?PHP DatabaseConnection::updateuploadeddata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DatabaseConnection
的用法示例。
在下文中一共展示了DatabaseConnection::updateuploadeddata方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DatabaseConnection
include '../common/DatabaseConnection.php';
$ds = DIRECTORY_SEPARATOR;
//1
$db = new DatabaseConnection();
$db->createConnection();
$storeFolder = '..\\..\\uploads\\' . $_POST['artefacttype'] . "\\";
if (isset($_FILES) && isset($_POST['artefactcode']) && isset($_POST['artefacttype']) && isset($_POST['attributecode'])) {
$ret = array();
$error = $_FILES["files"]["error"];
//You need to handle both cases
//If Any browser does not support serializing of multiple files using FormData()
if (!is_array($_FILES["files"]["name"])) {
$fileName = $_FILES["files"]["name"];
$ext = pathinfo($fileName, PATHINFO_EXTENSION);
move_uploaded_file($_FILES["files"]["tmp_name"], $storeFolder . $fileName);
$db->updateuploadeddata($_POST['artefactcode'], $fileName, $_POST['artefacttype'], $_POST['attributecode'], $_SESSION['userPK'], $ext);
//$ret[] = $fileName;
} else {
//echo $storeFolder;
$fileCount = count($_FILES["files"]["name"]);
for ($i = 0; $i < $fileCount; $i++) {
$fileName = $_FILES["files"]["name"][$i];
$ext = pathinfo($fileName, PATHINFO_EXTENSION);
move_uploaded_file($_FILES["files"]["tmp_name"][$i], $storeFolder . $fileName);
$db->updateuploadeddata($_POST['artefactcode'], $fileName, $_POST['artefacttype'], $_POST['attributecode'], $_SESSION['userPK'], $ext);
//$ret[] = $fileName;
}
}
echo "success";
} else {
echo "error";