當前位置: 首頁>>代碼示例>>PHP>>正文


PHP file::upload方法代碼示例

本文整理匯總了PHP中file::upload方法的典型用法代碼示例。如果您正苦於以下問題:PHP file::upload方法的具體用法?PHP file::upload怎麽用?PHP file::upload使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在file的用法示例。


在下文中一共展示了file::upload方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: file_upload

function file_upload($files)
{
    global $upload_path;
    $objects = array();
    foreach ($files as $file) {
        if (!empty($file['name'])) {
            $obj = new file();
            $obj->upload($file);
            $objects[] = $obj;
        }
    }
    return $objects;
}
開發者ID:nodefortytwo,項目名稱:areyouhappy,代碼行數:13,代碼來源:file.php

示例2: Field

<?php

require_once '_toolkit/main.php';
//var_export($_FILES);
if ($_FILES) {
    $file = file::upload('image', 'data/image/' . $_FILES['image']['name']);
    $ext = $file->getExtension();
    $file->rename('background' . $ext);
    $file->move('backgrounds/1/');
    echo $file->getBaseName() . html::br();
    echo $file->getFolder() . html::br();
    echo $file->getPath() . html::br();
    $img = $file->getImage();
    if ($img !== false) {
        $img->resize(100, 75);
    }
    //echo $img->htmlTag();
    echo html::img($file);
    //$file->delete();
} else {
    echo form::init(NULL, NULL, 'multipart/form-data');
    echo new Field('image', 'file');
    echo form::submit();
    echo '</form>';
}
開發者ID:reneolivo,項目名稱:PHP-Toolkit,代碼行數:25,代碼來源:files.php

示例3: import_from_file_id

 public static function import_from_file_id($file_id, $model_class, $options = array())
 {
     $result = array('success' => false, 'error' => array());
     do {
         $file_name = time() . '_' . rand(10000, 99999) . '_' . rand(10000, 99999) . '_' . trim($_FILES[$file_id]['name']);
         $directory = application::get(array('directory', 'temp', 'dir'));
         $file_result = file::upload($file_id, $file_name, $directory, array_keys(self::$formats));
         if (!$file_result['success']) {
             $result['error'] = array_merge($result['error'], $file_result['error']);
             break;
         }
         $import_result = self::import($file_result['file_name_full'], $model_class, $options);
         if ($import_result['error']) {
             array_merge3($result['error'], $import_result['error']);
             break;
         }
         $result['success'] = true;
     } while (0);
     return $result;
 }
開發者ID:volodymyr-volynets,項目名稱:framework,代碼行數:20,代碼來源:io.php

示例4: function

<?php

_::define_controller('download', function () {
    _::declare_component('file');
    // force download uploads/file.php
    $file = new file('uploads/', 'file.php');
    $file->download();
});
_::define_controller('upload', function () {
    _::declare_component('file');
    // for upload:
    $file = new file();
    $location = $file->upload('FIELD', 'uploads/', true, true, array('jpg', 'jpeg', 'png', 'gif'));
});
開發者ID:alexander171294,項目名稱:phpquery,代碼行數:14,代碼來源:file.example.php

示例5: ckupload

 public function ckupload()
 {
     $dir = 'data/pics/';
     $upload = file::upload('upload', $dir);
     //上傳圖片
     if (isset($upload['error'])) {
         echo 'upload error ' . $upload['error'];
     } else {
         if ($upload['success']) {
             $url = IMG_URL . $dir . $upload['success'][0];
             $fn = $this->req('CKEditorFuncNum');
             echo "<script>window.parent.CKEDITOR.tools.callFunction('{$fn}', '{$url}');</script>";
         } else {
             echo -1;
         }
     }
 }
開發者ID:justlikeheaven,項目名稱:buxun,代碼行數:17,代碼來源:controller_form.php


注:本文中的file::upload方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。