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


PHP files::getBaseUploadPath方法代码示例

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


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

示例1: processObjectUploads

 public static function processObjectUploads($objectID, $uploadID)
 {
     if (is_empty($uploadID)) {
         return array();
     }
     $uploadBase = files::getBaseUploadPath() . DIRECTORY_SEPARATOR . $uploadID;
     $saveBase = mfcs::config('convertedPath');
     // If the uploadPath dosen't exist, then no files were uploaded
     if (!is_dir($uploadBase)) {
         return TRUE;
     }
     // Generate new assets UUID and make the directory (this should be done quickly to prevent race-conditions
     $assetsID = self::newAssetsUUID();
     if (($originalsFilepath = self::getSaveDir($assetsID, 'archive')) === FALSE) {
         return array();
     }
     $return['uuid'] = $assetsID;
     // Start looping through the uploads and move them to their new home
     $files = scandir($uploadBase);
     foreach ($files as $filename) {
         if ($filename[0] == '.') {
             continue;
         }
         // Clean the filename
         $cleanedFilename = preg_replace('/[^a-z0-9-_\\.]/i', '', $filename);
         $newFilename = $originalsFilepath . DIRECTORY_SEPARATOR . $cleanedFilename;
         // Move the uploaded files into their new home and make the new file read-only
         if (@rename("{$uploadBase}/{$filename}", $newFilename) === FALSE) {
             errorHandle::newError(__METHOD__ . "() - renaming files: {$uploadBase}/{$filename}", errorHandle::DEBUG);
             return FALSE;
         }
         chmod($newFilename, 0444);
         $return['files']['archive'][] = array('name' => $cleanedFilename, 'path' => self::getSaveDir($assetsID, 'archive', FALSE), 'size' => filesize($newFilename), 'type' => self::getMimeType($newFilename), 'errors' => '');
     }
     // Remove the uploads directory (now that we're done with it) and lock-down the originals dir
     rmdir($uploadBase);
     chmod($originalsFilepath, 0555);
     // Return the array
     return $return;
 }
开发者ID:PseudoAj,项目名称:mfcs,代码行数:40,代码来源:files.php

示例2: define

<?php

require "../engineInclude.php";
require "../header.php";
define('UPLOAD_PATH', files::getBaseUploadPath());
define('PERMISSONS', 0777);
// Include the uploader class
recurseInsert("includes/class.fineUploader.php", "php");
$uploader = new qqFileUploader();
// Specify the list of valid extensions, ex. array("jpeg", "xml", "bmp")
$uploader->allowedExtensions = array();
// Specify the input name set in the javascript.
$uploader->inputName = 'qqfile';
// Preserve the file's extention for Mime-Type stuff
$filename = $uploader->getName();
$fileExt = "." . pathinfo($filename, PATHINFO_EXTENSION);
// To save the upload with a specified name, set the second parameter.
$uploadPath = UPLOAD_PATH . DIRECTORY_SEPARATOR . $engine->cleanPost['MYSQL']['uploadID'];
// Make sure the upload temp dir exits
if (!is_dir($uploadPath)) {
    mkdir($uploadPath, PERMISSONS, TRUE);
} else {
    if (!$engine->cleanPost['MYSQL']['multiple']) {
        $files = glob($uploadPath . DIRECTORY_SEPARATOR . '*');
        // get all existing file names
        foreach ($files as $file) {
            if (is_file($file)) {
                unlink($file);
            }
        }
    }
开发者ID:PseudoAj,项目名称:mfcs,代码行数:31,代码来源:uploader.php


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