当前位置: 首页>>代码示例>>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;未经允许,请勿转载。