<?php if (!defined('BLOG')) { exit('Access Denied'); } $do = !empty($_GET['do']) ? $_GET['do'] : ''; $doarr = array('article-new'); if (!in_array($do, $doarr)) { jsonOutput(2, '不允许的操作'); } $upload = new class_upload(); switch ($do) { case 'article-new': if (!$_B['uid']) { jsonOutput(2, 'login'); } $upload->init($_FILES['file'], 'article', 'data/attachment'); $file =& $upload->file; if (!$file['isimage']) { jsonOutput(2, '请上传图片附件 0027'); } if ($file['size'] > 2097152) { //2M jsonOutput(2, '请上传小余 2M 的图片 0032'); } $upload->save($file['tmp_name'], $file['target']); $errorcode = $upload->error(); if ($errorcode < 0) { $data = $upload->errormsg(); @unlink($file['target']); jsonOutput(2, $data);
<?php include_once "../includes/config.inc.php"; include_once "../includes/class-upload.php"; $customer_id = $_WGT['m_customer_id']; if (method_is('post')) { $upload = new class_upload(); $upload->upload_form_field = 'imgfile'; $upload->out_file_dir = '../data/image_c/' . $customer_id . '/' . date("Ymd"); $upload->max_file_size = 1024 * 1024 * 6; //6M $upload->make_script_safe = 1; $upload->allowed_file_ext = array('gif', 'jpg', 'jpeg', 'png'); $upload->upload_process(); if ($upload->error_no) { ajax_feedback(0, $upload->error_no); } //等比缩放 makethumb($upload->saved_upload_name, $upload->saved_upload_name, 800, 800, 1); $save_path = str_replace('../data/image_c/', '', $upload->saved_upload_name); ajax_feedback(1, array('path' => $save_path)); }
<?php session_start(); include("connect.inc"); include("class_file/class_upload.php"); $obj = new class_upload(); $obj->set_limit_type("pdf"); $obj->set_limit_size(1,"mb"); //$count = count($_FILES["upload_file"]); $list = ""; $j=0; $k=0; if($_FILES["upload_file"]["name"] != ""){ $fname = "dc-".$_POST["an"]."-".time(); $obj->set_file($_FILES["upload_file"]); $obj->set_path("./dcorder/"); $result = $obj->upload($fname); if(!$result){ $list .= "�͡��� AN : ".$_POST["an"]." �ջѭ�� ���ͧ�ҡ ".$obj->txt_error."<BR>"; $j++; }else{ $k++; $sql = "update ipcard set `fname` = '".$obj->fname."' where an = '".$_POST["an"]."' limit 1 ";