当前位置: 首页>>代码示例>>PHP>>正文


PHP FileUpload::GetDBFilePath方法代码示例

本文整理汇总了PHP中FileUpload::GetDBFilePath方法的典型用法代码示例。如果您正苦于以下问题:PHP FileUpload::GetDBFilePath方法的具体用法?PHP FileUpload::GetDBFilePath怎么用?PHP FileUpload::GetDBFilePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FileUpload的用法示例。


在下文中一共展示了FileUpload::GetDBFilePath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: FileUpload

 if ($_FILES['txtFile']['error'] && $_FILES['txtFile']['name']) {
     $blnSubmitForm = false;
     $strFileSubmitError = $CMS->FL->SubmissionError($_FILES['txtFile']['error']);
     $strFileError = $CMS->AC->InvalidFormData($strFileSubmitError);
 }
 $FU = new FileUpload();
 if ($_FILES['txtFile']['name']) {
     $FU->Setup($_FILES['txtFile']['name'], "Avatar", "");
 } else {
     $blnSubmitForm = false;
     $strFileError = $CMS->AC->InvalidFormData("");
 }
 // Check file size
 if ($_FILES['txtFile']['size'] > $intMaxFileSize) {
     $blnSubmitForm = false;
     $strFileError = $CMS->Err_MWarn(M_ERR_UPLOAD_FILESIZE, $FU->GetDBFilePath());
 }
 // Prevent two uploads referencing the same file
 if ($_FILES['txtFile']['name']) {
     if ($CMS->FL->IsDuplicateFile($FU->GetDBFilePath(), "")) {
         $blnSubmitForm = false;
         $strFileError = $CMS->Err_MWarn(M_ERR_UPLOAD_DUPLICATE, $FU->GetDBFilePath());
     }
     // Is this a valid image?
     $strExtension = $CMS->GetExtensionFromPath($FU->GetDBFilePath());
     if (strtoupper($strExtension) != "JPG" && strtoupper($strExtension) != "PNG") {
         $blnSubmitForm = false;
         $strFileError = $CMS->Err_MWarn(M_ERR_UPLOAD_NOT_IMAGE, $FU->GetDBFilePath());
     }
 }
 if ($blnSubmitForm) {
开发者ID:benbarden,项目名称:injader,代码行数:31,代码来源:upload_avatar.php

示例2: FileUpload

     if ($_FILES['txtFile']['error'] && $_FILES['txtFile']['name']) {
         $blnSubmitForm = false;
         $strFileSubmitError = $CMS->FL->SubmissionError($_FILES['txtFile']['error']);
         $strFileError = $CMS->AC->InvalidFormData($strFileSubmitError);
     }
     // OK to upload?
     $FU = new FileUpload();
     if ($_FILES['txtFile']['name']) {
         $FU->Setup($_FILES['txtFile']['name'], "File", "Upload");
     } elseif ($_POST['txtFileLocation']) {
         $FU->Setup($_POST['txtFileLocation'], "File", "Link");
     }
     // Prevent two uploads referencing the same file
     if ($_FILES['txtFile']['name']) {
         $strCurrentFileID = $blnExistingAttachment ? $intFileID : "";
         if ($CMS->FL->IsDuplicateFile($FU->GetDBFilePath(), $strCurrentFileID)) {
             $blnSubmitForm = false;
             $strFileError = $CMS->Err_MWarn(M_ERR_UPLOAD_DUPLICATE, $FU->GetDBFilePath());
         } else {
             // Is this a valid file?
             $fileExtension = $CMS->GetExtensionFromPath($FU->GetDBFilePath());
             $fileExtension = strtoupper($fileExtension);
             $allowedTypesArray = explode(",", C_ALLOWED_FILE_TYPES);
             if (!in_array($fileExtension, $allowedTypesArray)) {
                 $blnSubmitForm = false;
                 $strFileError = $CMS->Err_MWarn("For security reasons, this file type is not permitted. [{$fileExtension}]", $FU->GetDBFilePath());
             }
         }
     }
 }
 // ** Check if OK to submit ** //
开发者ID:benbarden,项目名称:injader,代码行数:31,代码来源:write.php


注:本文中的FileUpload::GetDBFilePath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。