本文整理汇总了PHP中AttachmentFile::allAsArray方法的典型用法代码示例。如果您正苦于以下问题:PHP AttachmentFile::allAsArray方法的具体用法?PHP AttachmentFile::allAsArray怎么用?PHP AttachmentFile::allAsArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AttachmentFile
的用法示例。
在下文中一共展示了AttachmentFile::allAsArray方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
foreach ($attachmentFile->allAsArray() as $attachmentTestArray) {
if (strtoupper($attachmentTestArray['attachmentURL']) == strtoupper($uploadAttachment)) {
$exists++;
}
}
echo $exists;
break;
//perform actual upload for attachments (4th tab)
//perform actual upload for attachments (4th tab)
case 'uploadAttachment':
$documentName = basename($_FILES['myfile']['name']);
$target_path = "attachments/" . basename($_FILES['myfile']['name']);
$attachmentFile = new AttachmentFile();
$exists = 0;
//loop through existing log attachments to verify that this name isn't already taken
foreach ($attachmentFile->allAsArray() as $attachmentTestArray) {
if (strtoupper($attachmentTestArray['attachmentURL']) == strtoupper($documentName)) {
$exists++;
}
}
//if match was not found
//note, echoes are not being sent anywhere
if ($exists == 0) {
if (move_uploaded_file($_FILES['myfile']['tmp_name'], $target_path)) {
//set to web rwx, everyone else rw
//this way we can edit the document directly on the server
chmod($target_path, 0766);
echo "success uploading!";
} else {
header('HTTP/1.1 500 Internal Server Error');
echo "<div id=\"error\">There was a problem saving your file to {$target_path}.</div>";