本文整理汇总了PHP中upload函数的典型用法代码示例。如果您正苦于以下问题:PHP upload函数的具体用法?PHP upload怎么用?PHP upload使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了upload函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: upload
/**
* Author : Jan Germann
* Datum : 26.04.2010
* Modul : files
* Beschreibung : Dateien Hochladen in UPLOAD_DIR
*/
function upload()
{
global $msg, $mysql, $log;
if (!isset($_POST['submit'])) {
$tpl = dirname(__FILE__) . "/template/upload.form.tpl";
if (is_file($tpl)) {
$template = file_get_contents($tpl);
}
$template = str_replace("%name%", $_POST['name'], $template);
$template = str_replace("%description%", $_POST['description'], $template);
return $data = $template;
} else {
if ($_FILES['file']['error'] == 4) {
$msg->error("Es wurde keine Datei hochgeladen.");
}
if (empty($_POST['name'])) {
$msg->error("Es wurde kein Name angegeben.");
}
if ($msg->error) {
unset($_POST['submit']);
return upload();
} else {
$safe_filename = preg_replace(array("/\\s+/", "/[^-\\.\\w]+/"), array("_", ""), trim($_FILES['file']['name']));
if (is_uploaded_file($_FILES['file']['tmp_name']) && !@move_uploaded_file($_FILES['file']['tmp_name'], UPLOAD_DIR . $safe_filename)) {
$msg->error("Fehler beim Dateiupload.");
unset($_POST['submit']);
return upload();
}
$mysql->insert("files", array(NULL, mysql_real_escape_string($_POST['name']), mysql_real_escape_string($_POST['description']), $safe_filename));
$msg->success("Upload erfolgreich.");
$log->add("Dateiupload", "<file>" . $safe_filename . "</file><name>" . mysql_real_escape_string($_POST['name']) . "</name><description>" . mysql_real_escape_string($_POST['description']) . "</description>");
}
}
}
开发者ID:nubix,项目名称:cms,代码行数:40,代码来源:function.upload.php
示例2: lisa
function lisa()
{
// siia on vaja funktsionaalsust (13. nädalal)
if (!empty($_SESSION["user"])) {
if ($_SERVER['REQUEST_METHOD'] == "POST") {
// postitus on tehtud
if (in_array("", $_POST) || $_FILES["pilt"]["error"] > 0) {
$errors[] = "Mingi väli jäi postitamisel tühjaks või on faili üleslaadimisel tekkinud viga.";
include_once 'views/loomavorm.html';
} else {
// kõik ok, laeme faili üles ja teeme kirje tabelisse
connect_db();
upload("pilt");
$query = "INSERT INTO ttilk__loomaaed (NIMI, PUUR, PILT) \n\t\t\t\t\t\t\tVALUES ('" . mysqli_real_escape_string($GLOBALS['connection'], $_POST["nimi"]) . "', '" . mysqli_real_escape_string($GLOBALS['connection'], $_POST["puur"]) . "', '" . "pildid/" . $_FILES["pilt"]["name"] . "');";
$result = mysqli_query($GLOBALS['connection'], $query) or die("{$query} - " . mysqli_error($GLOBALS['connection']));
echo $_FILES["pilt"]["name"];
//header("refresh:3; url=loomaaed.php?page=loomad");
}
// if
} else {
include_once 'views/loomavorm.html';
}
// if $_SERVER
} else {
header("Location: loomaaed.php?page=login");
}
// if !empty
}
开发者ID:TaaviTilk,项目名称:i244_kodutood,代码行数:28,代码来源:funk.php
示例3: pic
public function pic()
{
if (isset($_FILES['headpic']['name']) && strlen($_FILES['headpic']['name']) > 0) {
$arr = array('upload' => 'headpic', 'ext' => array('jpg', 'jpeg', 'png', 'gif'), 'size' => 10240, 'path' => './asset/upload/');
$file = upload($arr);
if ($file['result']) {
$user = new UserModel();
$picName = $file['message'];
$rst = $user->setPics($picName);
if ($rst) {
R('User', 'ePic');
//$newUrl = U('User','ePic');
//echo "<script>window.location='http://localhost/YYK/msg/User/ePic.html'</script>";
} else {
//E($this->errors['054']);
var_dump($rst);
echo "Wrong!~";
}
} else {
//E($file['message']);
echo "Wrong";
}
} else {
var_dump($_FILES);
}
}
开发者ID:Jnnock,项目名称:myyyk,代码行数:26,代码来源:UserCtrl.class.php
示例4: lisa
function lisa()
{
global $connection;
if (empty($_SESSION["user"])) {
header("Location: ?page=login");
} else {
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($_POST["nimi"] == '' || $_POST["puur"] == '') {
$errors = array();
if (empty($_POST["nimi"])) {
$errors[] = "Palun sisesta nimi!";
}
if (empty($_POST["puur"])) {
$errors[] = "Palun sisesta puur!";
}
} else {
upload('liik');
$nimi = mysqli_real_escape_string($connection, $_POST["nimi"]);
$puur = mysqli_real_escape_string($connection, $_POST["puur"]);
$liik = mysqli_real_escape_string($connection, "pildid/" . $_FILES["liik"]["name"]);
$sql = "INSERT INTO kleemets_loomaaed (nimi, PUUR, liik) VALUES ('{$nimi}','{$puur}','{$liik}')";
$result = mysqli_query($connection, $sql);
$id = mysqli_insert_id($connection);
if ($id) {
header("Location: ?page=loomad");
} else {
header("Location: ?page=loomavorm");
}
}
}
}
include_once 'views/loomavorm.html';
}
开发者ID:kleemets,项目名称:Vorgurakendused,代码行数:33,代码来源:funk.php
示例5: uploadFile
function uploadFile()
{
global $_POST;
global $_FILES;
global $ATTACHMENT_ID_OLD;
global $ATTACHMENT_NAME_OLD;
if ($_POST['通达格式上传文件'] != "") {
if (count($_FILES) > 1) {
$ATTACHMENTS = upload();
$CONTENT = ReplaceImageSrc($CONTENT, $ATTACHMENTS);
$ATTACHMENT_ID = $ATTACHMENT_ID_OLD . $ATTACHMENTS["ID"];
$ATTACHMENT_NAME = $ATTACHMENT_NAME_OLD . $ATTACHMENTS["NAME"];
} else {
$ATTACHMENT_ID = $ATTACHMENT_ID_OLD;
$ATTACHMENT_NAME = $ATTACHMENT_NAME_OLD;
}
$ATTACHMENT_ID .= copy_sel_attach($ATTACH_NAME, $ATTACH_DIR, $DISK_ID);
$ATTACHMENT_NAME .= $ATTACH_NAME;
$上传附件字段名称 = $_POST['通达格式上传文件'];
//对附件上传字段重新赋值
$_POST[$上传附件字段名称] = $ATTACHMENT_NAME . "||" . $ATTACHMENT_ID;
//print_R($_POST);print_R($_FILES);print_R($ATTACHMENT_NAME);print_R($ATTACHMENT_ID);exit;
}
//通达格式上传文件处理结束
}
开发者ID:shesai0519,项目名称:sunshineCRM,代码行数:25,代码来源:uploadFile.php
示例6: saveKimport
function saveKimport($option)
{
if (isset($_FILES['uploadfile']) && is_array($_FILES['uploadfile'])) {
$file = $_FILES['uploadfile'];
upload($option, $file, '');
}
}
开发者ID:kaantunc,项目名称:MYK-BOR,代码行数:7,代码来源:kexport.php
示例7: lisa
function lisa()
{
// siia on vaja funktsionaalsust (13. nädalal)
$errors = array();
if (!empty($_SESSION['username'])) {
include_once 'views/login.html';
} else {
if ($_SERVER['REQUEST_METHOD'] == "POST") {
if (in_array("", $_POST)) {
$errors[] = "Väljad täita!";
include_once 'views/loomavorm.html';
} else {
global $connection;
upload('liik');
$nimi = mysqli_real_escape_string($connection, $_POST['nimi']);
$puur = mysqli_real_escape_string($connection, $_POST['puur']);
$liik = mysqli_real_escape_string($connection, "pildid/" . $_FILES["liik"]["name"]);
$query = "INSERT INTO aveinber_loomaaed (nimi, puur, liik ) values ('{$nimi}','{$puur}','{$liik}')";
$result = mysqli_query($connection, $query) or die("Ei saanud päringut teha " . mysqli_error($connection));
header('Location:loomaaed.php?page=loomad');
}
} else {
include_once 'views/loomavorm.html';
}
}
}
开发者ID:aveinber,项目名称:Ylesanded,代码行数:26,代码来源:funk.php
示例8: internal_upload
/**
* Functions registered with the worker
*
* @param object $job
* @return void
*/
function internal_upload($job)
{
//Get the info of the job
list($localFilename, $remoteFilename, $removeFile) = unserialize($job->workload());
//Default value if empty
if (is_null($removeFile)) {
$removeFile = FALSE;
}
//Do some checks
if (empty($localFilename) || empty($remoteFilename)) {
logError(sprintf("%s: The workload do not contain the required info to do the upload\n\n", date('r')));
$job->sendFail();
return FALSE;
}
echo sprintf("%s: Received job to internal upload %s\n", date('r'), $localFilename);
//Do the upload
$uploaded = upload($localFilename, $remoteFilename);
if ($uploaded !== TRUE) {
logError(sprintf("%s: Error while uploading the file to Amazon S3 - %s\n\n", date('r'), $uploaded->getMessage()));
$job->sendFail();
return FALSE;
}
//Check if we have to remove the file
if ($removeFile) {
//Remove the original file
if (!unlink(ROOT_PATH . '/public/frontend/tmp/' . $localFilename)) {
logError(sprintf("%s: Error removing the file\n\n", date('r')));
$job->sendFail();
return FALSE;
}
}
$job->sendComplete(TRUE);
echo sprintf("%s: Job finished successfully\n\n", date('r'));
return TRUE;
}
开发者ID:omusico,项目名称:logica,代码行数:41,代码来源:InternalUploadWorker.php
示例9: lisa
function lisa()
{
// siia on vaja funktsionaalsust (13. nädalal)
global $connection;
if (isset($_SESSION['user_role']) && $_SESSION['user_role'] == "admin") {
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$upload_field_name = 'liik';
if (empty($_POST['nimi'])) {
$errors['empty_name'] = "Sisesta nimi";
}
if (empty($_POST['puur'])) {
$errors['empty_cage'] = "Sisesta puur";
}
//if(empty($_POST['liik'])) $errors['empty_species'] = "Sisesta liik";
if (upload($upload_field_name) == "") {
$errors['upload_failed'] = "Faili upload ebaõnnestus";
}
$speciesFromImageName = explode(".", $_FILES[$upload_field_name]["name"]);
$insertName = mysqli_real_escape_string($connection, htmlspecialchars($_POST['nimi']));
$insertCage = mysqli_real_escape_string($connection, htmlspecialchars($_POST['puur']));
$insertSpecies = mysqli_real_escape_string($connection, htmlspecialchars($speciesFromImageName[0]));
$sql = "INSERT INTO `rturi_zoo`(`name`, `species`, `cage`) VALUES ('" . $insertName . "','" . $insertSpecies . "'," . $insertCage . ")";
$result = mysqli_query($connection, $sql) or die("{$sql} - " . mysqli_error($connection));
echo mysqli_insert_id($connection);
if (mysqli_insert_id($connection) > 0) {
header("Location: ?page=loomad");
exit(0);
}
}
} else {
header("Location: ?");
exit(0);
}
include_once 'views/loomavorm.html';
}
开发者ID:rturi,项目名称:I244,代码行数:35,代码来源:funk.php
示例10: uploadResume
public function uploadResume($file, $pdfPath, $thumbPath)
{
$types = array("application/pdf", "application/x-pdf", "text/pdf", "application/acrobat", "application/vnd.pdf", "application/msword", "application/vnd.openxmlformats-officedocument.wordprocessingml.document");
$pad = str_replace(" ", "_", $this->fullName);
$attempt = upload($pdfPath, $file, $pad, $types);
if (!is_array($attempt)) {
return $attempt;
}
if (!array_key_exists("main_name", $attempt) || !array_key_exists("new_name", $attempt)) {
return $attempt;
}
$newName = $attempt['new_name'];
$conn = new PDO(DB_DSN, DB_USER, DB_PASS);
$sql = "INSERT INTO seekers(userID, cv_file) VALUES(:id, :file)";
if ($this->getResumeFile()) {
$sql = "UPDATE seekers SET cv_file = :file WHERE userID = :id";
}
$st = $conn->prepare($sql);
$st->bindParam(":id", $this->userID);
$st->bindParam(":file", $newName);
try {
if (!$st->execute()) {
unlink($pdfPath . $newName);
return $st->errorInfo();
} else {
$mainFile = $pdfPath . $newName;
$thumb = $newName . ".jpg";
//execute ImageMagick's convert command
//exec("covert \"{$mainFile[0]}\" -colorspace RGB -geometry 400 $thumbPath$thumb");
return true;
}
} catch (PDOException $e) {
return $e->getMessage();
}
}
开发者ID:idoqo,项目名称:yedoe,代码行数:35,代码来源:Student.php
示例11: upload
public function upload()
{
$data = upload('./Wx/Material/');
if (is_array($data)) {
$path = 'http://' . $_SERVER['HTTP_HOST'] . ltrim($data['file']['file_save_path'], '.');
$this->ajaxSuccess($path);
}
$this->ajaxError('上传失败' . $data);
}
开发者ID:xswolf,项目名称:dc,代码行数:9,代码来源:MaterialController.class.php
示例12: doUpload
function doUpload()
{
// Metadaten zu Banner angegeben?
if (empty($_GET["tag"]) || empty($_GET["name"])) {
die(json_encode(array("error" => "FORM VALIDATION: Kein Allianzname oder kein Allianztag angegeben.")));
}
// Datei hochgeladen?
if (empty($_FILES[UPLOAD_BANNER_ID])) {
die(json_encode(array("error" => "FORM VALIDATION: Keine Datei zum Hochladen ausgew&aauml;hlt.")));
}
// Fehler beim upload
if (isset($_FILES[UPLOAD_BANNER_ID]['error']) && intval($_FILES[UPLOAD_BANNER_ID]['error']) > 0) {
switch ($_FILES[UPLOAD_BANNER_ID]['error']) {
case '1':
$error = 'The uploaded file exceeds the upload_max_filesize directive in php.ini';
break;
case '2':
$error = 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form';
break;
case '3':
$error = 'The uploaded file was only partially uploaded';
break;
case '4':
$error = 'No file was uploaded.';
break;
case '6':
$error = 'Missing a temporary folder';
break;
case '7':
$error = 'Failed to write file to disk';
break;
case '8':
$error = 'File upload stopped by extension';
break;
case '999':
default:
$error = 'No error code avaiable';
}
die(json_encode(array("error" => "UPLOAD ERROR: " . $error . ".")));
}
$tmp_filename = $_FILES[UPLOAD_BANNER_ID]['tmp_name'];
$img_size = getimagesize($tmp_filename);
// Datei ist Bild?
if (!is_array($img_size)) {
die(json_encode(array("error" => "UPLOAD ERROR: Die hochgeladene Datei ist kein Bild.")));
}
// Datei hat richtige Größe?
if ($img_size[0] != BANNER_WIDTH || $img_size[1] != BANNER_HEIGHT) {
die(json_encode(array("error" => "UPLOAD ERROR: Die hochgeladene Datei hat nicht die richtige Größe. (Breite: " + BANNER_WIDTH + ", Höhe: " + BANNER_HEIGHT + ")")));
}
// Allright, copy file and return info
$id = upload($_FILES[UPLOAD_BANNER_ID], $_GET["tag"], $_GET["name"]);
$banner = get_banner($id);
echo '{"success": true, id: "' . $id . '", "filename": "' . rawurlencode($banner["url"]) . '", "path": "' . rawurlencode(BANNER_PATH . $banner["url"]) . '"}';
}
开发者ID:robkub,项目名称:tc-tools,代码行数:55,代码来源:ajax.php
示例13: uploadImg
/**
* 上传图片
*/
public function uploadImg()
{
//'ybFlQ9kmPTgiCWZT8Mq_1YnKtBziwpbaVDaftpJckPtFzlwROlgXpKCd9Dbl_JRs'
if (!empty($_FILES)) {
$info = reset(upload());
$data = Media::upload(realpath($info['file_save_path']), 'image');
file_put_contents('./wx-test/uploadimg.txt', json_encode($data));
dump($data);
}
// dump( Media::upload(realpath('./Public/Uploads/2015-09-23/560218d10525f.jpg'),'image' ));
}
开发者ID:xswolf,项目名称:dc,代码行数:14,代码来源:ArticlesEvent.class.php
示例14: addAttachment
public function addAttachment($file, $path)
{
$allowed = array("image/jpeg", "image/jpg", "image/png", "image/gif", "application/pdf", "application/x-pdf", "text/pdf", "application/acrobat", "application/vnd.pdf", "application/msword", "application/vnd.openxmlformats-officedocument.wordprocessingml.document");
$pad = uniqid('msg_file_', true);
$attempt = upload($path, $file, $pad, $allowed);
if (!is_array($attempt)) {
return $attempt;
}
if (!array_key_exists("main_name", $attempt) || !array_key_exists("new_name", $attempt)) {
return $attempt;
}
}
开发者ID:idoqo,项目名称:yedoe,代码行数:12,代码来源:Message.php
示例15: processRequest
public function processRequest()
{
if ($_SERVER["REQUEST_METHOD"] == "GET") {
print "WebORB v3.5.0";
}
$timeStart = microtime(true);
ob_start();
$inputData = file_get_contents("php://input");
if (isset($_FILES['Filedata'])) {
$config = ORBConfig::getInstance();
if (!defined("WebOrbServicesPath")) {
define("WebOrbServicesPath", realpath(WebOrb . $config->getServicePath()) . DIRECTORY_SEPARATOR);
if (LOGGING) {
Log::log(LoggingConstants::DEBUG, "WebORB services path is - " . WebOrbServicesPath);
}
}
require_once WebOrbServicesPath . "Weborb/Examples/Upload.php";
upload();
exit;
}
$startRead = microtime(true);
try {
$config = ORBConfig::getInstance();
if (!defined("WebOrbServicesPath")) {
define("WebOrbServicesPath", realpath(WebOrb . $config->getServicePath()) . DIRECTORY_SEPARATOR);
if (LOGGING) {
Log::log(LoggingConstants::DEBUG, "WebORB services path is - " . WebOrbServicesPath);
}
}
$contentType = "text/html";
if (stripos($_SERVER["CONTENT_TYPE"], "wolf/xml") !== false) {
$contentType = "wolf/xml";
} elseif (stripos($_SERVER["CONTENT_TYPE"], "application/x-amf") !== false) {
$contentType = "application/x-amf";
}
$request = $config->getProtocolRegistry()->buildMessage($contentType, $inputData);
} catch (Exception $e) {
if (LOGGING) {
Log::logException(LoggingConstants::ERROR, "Internal error", $e);
}
ob_clean();
return;
}
if (DrupalDispatcher::dispatch($request)) {
$this->serializeResponse($request);
}
$logMessage = sprintf("Final Execute time: %0.3f", microtime(true) - $timeStart);
if (LOGGING) {
Log::log(LoggingConstants::PERFORMANCE, $logMessage);
}
}
开发者ID:sigmadesarrollo,项目名称:logisoft,代码行数:51,代码来源:DrupalHttpHandler.php
示例16: content
private function content($ref_id)
{
$ext = 'jpg,jpeg,gif,png';
$files = isset($_FILES['filedata']) ? $_FILES['filedata'] : null;
$attachment = upload($files, false, $ext, 'content', $error);
if ($attachment != '') {
$data = ['uploadfrom' => 'content', 'ref_id' => $ref_id, 'path' => $attachment];
//Upload_Model::saveUpload($data);
echo "{'err':'','msg':'" . $attachment . "'}";
exit;
}
echo "{'err':'{$error}','msg':''}";
exit;
}
开发者ID:GavinLai,项目名称:SimMatch,代码行数:14,代码来源:Upload_Controller.php
示例17: uploadx
public function uploadx($name = '')
{
$name = trim($name);
$uploadConfig = array($_FILES['photo'], 1024 * 1024 * 10, array('jpg', 'png', 'gif', 'jpeg'), C('PHOTOS_IMAGE_PATH'), false, $name);
$uploadResult = upload($uploadConfig[0], $uploadConfig[1], $uploadConfig[2], $uploadConfig[3], $uploadConfig[4], $uploadConfig[5]);
$uploadResult = (array) $uploadResult;
if ($uploadResult['success']) {
$newId = $this->_service->add($uploadResult['savename'], $uploadResult['filePath']);
$uploadResult['newId'] = $newId;
//生成ID
}
$this->assign('inst', $uploadResult);
$this->display('result');
}
开发者ID:QinShangQs,项目名称:training,代码行数:14,代码来源:IndexController.class.php
示例18: show_img_upload
function show_img_upload()
{
global $connection;
$thumb_upload = '';
$img_upload = '';
$input_title = '';
$input_author = '';
if (isset($_SESSION['username'])) {
$errors = array();
if (!empty($_POST)) {
if (empty($_POST['title'])) {
$errors['upload_empty_title'] = "Palun sisesta pildi nimi";
} else {
$input_title = htmlspecialchars($_POST['title']);
}
if (empty($_POST['author'])) {
$errors['upload_empty_author'] = "Palun sisesta pildi autor";
} else {
$input_author = htmlspecialchars($_POST['author']);
}
$thumb_upload = upload('thumb', 'thumb');
$img_upload = upload('img', 'img');
if ($img_upload == "") {
$errors['upload_img_failed'] = "Suure pildi upload ebaõnnestus";
}
if ($thumb_upload == "") {
$errors['upload_thumb_failed'] = "Väikse pildi upload ebaõnnestus";
}
echo $thumb_upload;
listFolderFiles('thumb/');
if (!isset($errors['upload_empty_author']) && !isset($errors['upload_empty_title']) && !isset($errors['upload_img_failed']) && !isset($errors['upload_thumb_failed'])) {
$sql = "INSERT INTO `rturi_pildid`(`thumb`, `pilt`, `pealkiri`, `autor`) VALUES ('thumb/" . mysqli_real_escape_string($connection, $thumb_upload) . "','img/" . mysqli_real_escape_string($connection, $img_upload) . "','" . mysqli_real_escape_string($connection, $input_title) . "','" . mysqli_real_escape_string($connection, $input_author) . "')";
$result = mysqli_query($connection, $sql) or die("{$sql} - " . mysqli_error($connection));
if (mysqli_insert_id($connection) > 0) {
$_SESSION['upload_success'] = 'Pildi upload õnnestus';
header("Location: ?mode=gallery");
exit(0);
} else {
$errors['upload_db_insert_failed'] = "Pildi salvestamine ebaõnnestus. Sorry.";
}
}
}
include_once 'view/head.html';
include 'view/img_upload.html';
include_once 'view/foot.html';
} else {
header('Location: ?mode=main_page');
exit(0);
}
}
开发者ID:rturi,项目名称:I244,代码行数:50,代码来源:functions.php
示例19: uploadForm
private function uploadForm()
{
global $CORE;
echo '<h2>' . l('Upload Shape') . '</h2>';
if (is_action() && post('mode') == 'upload') {
try {
if (!isset($_FILES['image'])) {
throw new FieldInputError('image', l('You need to select an image to import.'));
}
$file = $_FILES['image'];
if (!is_uploaded_file($file['tmp_name'])) {
throw new FieldInputError('image', l('The file could not be uploaded (Error: [ERROR]).', array('ERROR' => $file['error'] . ': ' . $CORE->getUploadErrorMsg($file['error']))));
}
$file_name = $file['name'];
$file_path = path('sys', '', 'shapes') . $file_name;
if (!preg_match(MATCH_PNG_GIF_JPG_FILE, $file_name)) {
throw new FieldInputError('image', l('The uploaded file is no image (png,jpg,gif) file or contains unwanted chars.'));
}
$data = getimagesize($file['tmp_name']);
if (!in_array($data[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG))) {
throw new FieldInputError('image', l('The uploaded file is not an image ' . '(png, jpg and gif are allowed).'));
}
move_uploaded_file($file['tmp_name'], $file_path);
$CORE->setPerms($file_path);
success(l('The shape has been uploaded.'));
//reload(null, 1);
} catch (FieldInputError $e) {
form_error($e->field, $e->msg);
} catch (Exception $e) {
if (isset($e->msg)) {
form_error(null, $e->msg);
} else {
throw $e;
}
}
}
echo $this->error;
js_form_start('upload_shape');
hidden('mode', 'upload');
echo '<input type="hidden" id="MAX_FILE_SIZE" name="MAX_FILE_SIZE" value="1000000" />';
echo '<table class="mytable">';
echo '<tr><td class="tdlabel">' . l('Choose an Image') . '</td>';
echo '<td class="tdfield">';
upload('image');
echo '</td></tr>';
echo '</table>';
submit(l('Upload'));
form_end();
}
开发者ID:rbarraud,项目名称:nagvis,代码行数:49,代码来源:ViewManageShapes.php
示例20: insert_base
public function insert_base($web_base_info_m, $action, $web_name, $web_extension, $content, $type)
{
$file = $_FILES['logo'];
$mes = upload($file);
if (is_bool($mes)) {
showMessage('图片上传失败!', "admin_csystem_mweb_base_info.html");
}
if (is_numeric($mes)) {
showMessage('操作错误', 'admin_csystem_mweb_base_info.html');
}
if ($web_base_info_m->add($web_name, $web_extension, $content, $type, $mes)) {
showMessage('网站信息添加成功!', "admin_csystem_mweb_base_info.html");
} else {
showMessage('网站信息添加失败!', "admin_csystem_mweb_base_info.html");
}
}
开发者ID:siyizhen,项目名称:my_cms,代码行数:16,代码来源:systemController.class.php
注:本文中的upload函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论