Class: Upload
Source Location: /libs/Upload.php
アップãƒãƒ¼ãƒ‰ class
Author(s):
Version:
0.0.1 PHP version 5 usage:
[html]
<form method="post" action="..." enctype="multipart/form-data"> // enctype ã®æ›¸ã忘れã«æ³¨æ„。
<input type="file" name="upload_document[1]" />
<input type="file" name="upload_image[1]" />
<input type="file" name="upload_image[2]" />
<input type="file" name="upload_image[3]" />
[php]
require_once '/path/to/Upload.php';
$params = array();
$params['upload_document'][1] = array('ワードãªã©ã®åŽŸç¨¿', 2, 'MB');
$params['upload_image'][1] = array('ç”»åƒ1', 100, 'KB', '/^(gif|png|jpe?g)$/i');
$params['upload_image'][2] = array('ç”»åƒ2', 1, 'MB', '/^(gif|png|jpe?g)$/i');
$params['upload_image'][3] = array('ç”»åƒ3', 1, 'MB', '/^(gif|png|jpe?g)$/i');
$upload = new Upload($params);
// アップãƒãƒ¼ãƒ‰é–¢é€£ã®è¨å®šã‚’表示
$upload->getInfo();
$upload->setUploadDir('/path/to/upload');
// (optional) yyyymmddå½¢å¼ã®ã‚µãƒ–ディレクトリを生æˆã™ã‚‹
$upload->setUploadDir('/path/to/upload')->subDir('%yyyymmdd%');
// (optional) åå‰ã‚’指定ã—ã¦ã‚µãƒ–ディレクトリを生æˆã™ã‚‹
$upload->setUploadDir('/path/to/upload')->subDir('subdirname');
if ($upload->execute() === false) {
echo $upload->getErrMsg();
} else {
var_dump($upload->getResults());
}
array(1) {
[0]=>
array(3) {
["fieldlabel"]=>
string(13) "ç”»åƒ1"
["orig_filename"]=>
string(49) "ç”»åƒ1.jpg"
["filename"]=>
string(35) "20090406_123527_upload_image_1_1214.jpg"
["filepath"]=>
string(90) "/path/to/upload/20090406_123527_upload_image_1_1214.jpg"
}
[1]=>
array(3) {
}
:
:
}
|
|
|
|
Class Details
Class Variables
Class Methods
Class Constants
|
|