當前位置: 首頁>>代碼示例>>PHP>>正文


PHP AttachmentFile::allAsArray方法代碼示例

本文整理匯總了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>";
開發者ID:veggiematts,項目名稱:coral-licensing,代碼行數:31,代碼來源:ajax_processing.php


注:本文中的AttachmentFile::allAsArray方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。