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


PHP FileManager::MoveUpload方法代码示例

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


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

示例1: process

 public function process()
 {
     if (!empty($this->value['tmp_name']) && !empty($this->value['name'])) {
         $result = FileManager::MoveUpload($this->value['tmp_name'], $this->_directory . '/' . $this->value['name']);
         if (!FileManager::Error()) {
             $this->value = basename($result);
         } else {
             $this->error = 'Unable to upload ' . $this->label . ': ' . FileManager::Error();
         }
     } else {
         $this->value = '';
     }
 }
开发者ID:ssrsfs,项目名称:blg,代码行数:13,代码来源:File.php

示例2: mkdir

<?php

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $base = TYPEF_DIR . '/files/public/userfiles/' . Typeframe::User()->get('userid');
    if (!file_exists($base)) {
        mkdir($base);
    }
    $folder = isset($_REQUEST['folder']) ? $_REQUEST['folder'] : '';
    $currentFolder = "{$base}/{$folder}";
    $moved = FileManager::MoveUpload($_FILES['upload']['tmp_name'], "{$currentFolder}/{$_FILES['upload']['name']}");
    $message = '';
    if ($moved) {
        $moved = basename($moved);
    } else {
        $moved = '';
        $message = 'Upload failed.';
    }
    if (!empty($_REQUEST['command']) && $_REQUEST['command'] == 'BrowserUpload') {
        Typeframe::Redirect('File uploaded.', TYPEF_WEB_DIR . '/ckeditor/browse?type=' . $_REQUEST['type'] . '&folder=' . $_REQUEST['folder'] . '&CKEditorFuncNum=' . $_REQUEST['CKEditorFuncNum']);
    } else {
        if ($moved) {
            $pm->setVariable('file', TYPEF_WEB_DIR . '/files/public/userfiles/' . Typeframe::User()->get('userid') . ($folder ? '/' . $folder : '') . '/' . $moved);
        }
        $pm->setVariable('funcnum', $_REQUEST['CKEditorFuncNum']);
        $pm->setVariable('message', $message);
    }
}
开发者ID:ssrsfs,项目名称:blg,代码行数:27,代码来源:upload.php

示例3: returnerror

if ($_FILES['___uploadfile']['error'] == UPLOAD_ERR_PARTIAL) {
    returnerror('The uploaded file was only partially uploaded. ');
}
// 3
if ($_FILES['___uploadfile']['error'] == UPLOAD_ERR_NO_FILE) {
    returnerror('No file was uploaded. ');
}
// 4
if ($_FILES['___uploadfile']['error'] == UPLOAD_ERR_NO_TMP_DIR) {
    returnerror('Missing a temporary folder.');
}
// 6
if ($_FILES['___uploadfile']['error'] == UPLOAD_ERR_CANT_WRITE) {
    returnerror('Failed to write file to disk.');
}
// 7
if ($_FILES['___uploadfile']['error'] == UPLOAD_ERR_EXTENSION) {
    returnerror('A PHP extension stopped the file upload.');
}
// 8
// basedir needs to start with a '/'.
if ($_POST['basedir'][0] != '/') {
    $_POST['basedir'] = '/' . $_POST['basedir'];
}
// Guess I should do the save now that all checks have passed...
$image = @FileManager::MoveUpload($_FILES['___uploadfile']['tmp_name'], TYPEF_DIR . $_POST['basedir'] . '/' . $_FILES['___uploadfile']['name']);
if (!$image) {
    returnerror('Unable to move uploaded file to ' . $_POST['basedir']);
}
// Must have went through.
die(json_encode(array('status' => 1, 'filename' => $image, 'basename' => basename($image))));
开发者ID:ssrsfs,项目名称:blg,代码行数:31,代码来源:dyneditable.php


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