本文整理汇总了PHP中upload::upload_process方法的典型用法代码示例。如果您正苦于以下问题:PHP upload::upload_process方法的具体用法?PHP upload::upload_process怎么用?PHP upload::upload_process使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类upload
的用法示例。
在下文中一共展示了upload::upload_process方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
function upload_pic($file = array(), $other = array())
{
if (!$file || !$other) {
return false;
}
$upload = new upload("pic");
$upload->out_file_dir = "./statics/images/idea";
$upload->out_file_name = "idea" . time();
$upload->upload_process();
$error_no = $upload->error_no;
if ($error_no > 0) {
return flase;
}
$other["add_time"] = time();
$other["location"] = trim($upload->saved_upload_name, ".");
$other["belong_to"] = "idea";
$rs = daocall("admin", "insert_pic", array($other));
if (!$rs) {
return false;
}
return true;
}
示例2: upload
public function upload($field = 'file', $directoryExtend = '', $required = false, $resize = false, $watermark = '', $watermarkOver = 0, $watermarkPosition = '')
{
$file = '';
if (isset($_FILES[$field]['name']) && strlen($_FILES[$field]['name']) > 3) {
recursive_mkdir(DATA_SERVER_PATH . "/uploads/" . $this->uploadFileDirectory . $directoryExtend);
$upload = new upload();
$upload->upload_form_field = $field;
$upload->out_file_dir = DATA_SERVER_PATH . "/uploads/" . $this->uploadFileDirectory . $directoryExtend;
$upload->max_file_size = $this->maxFileSize;
$upload->make_script_safe = 1;
$upload->allowed_file_ext = $this->fileExt;
$upload->upload_process();
if ($upload->error_no) {
switch ($upload->error_no) {
case 1:
// 无上传
return "error_no_file_upload";
exit;
case 2:
// 无效的扩展名
return "error_invalid_file_ext";
exit;
case 3:
// 太大...
return "error_file_too_big";
exit;
case 4:
// 无法移动上传的文件
return "error_no_file_upload";
exit;
}
}
$file = substr($upload->saved_upload_name, strlen(DATA_SERVER_PATH . "/uploads/" . $this->uploadFileDirectory . $directoryExtend));
$this->lastUploadedFile = $file;
if ($resize) {
$this->resizeImages($file, $directoryExtend, $watermark, $watermarkOver, $watermarkPosition);
}
} elseif ($required) {
return 'error_file_not_set';
}
return $file;
}