本文整理汇总了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;
}
示例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);
}
}
}