本文整理汇总了PHP中uploader::upload方法的典型用法代码示例。如果您正苦于以下问题:PHP uploader::upload方法的具体用法?PHP uploader::upload怎么用?PHP uploader::upload使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类uploader
的用法示例。
在下文中一共展示了uploader::upload方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
Yii::import('ext.editMe.vendors.kcfinder.core.*');
Yii::import('ext.editMe.vendors.kcfinder.lib.*');
$uploader = new uploader();
$uploader->upload();
}
示例2: UploadFoto
function UploadFoto()
{
require "modulos/fileupload/fileupload-class.php";
$full = "productos_img/";
//$mini = "productos_img/";
$my_uploader = new uploader();
$success = $my_uploader->upload("file", "", ".jpg");
if ($success) {
$modo = 2;
$success = $my_uploader->save_file($full, $modo);
if (!$success) {
return false;
}
return $my_uploader->file['name'];
}
return false;
}
示例3: numbers
$chars = numbers($config['maxaboutlength']);
$bbcode = initBBCodes();
$inner['bbhtml'] = $bbcode->getbbhtml();
$inner['smileys'] = $bbcode->getsmileyhtml($config['smileysperrow']);
$mymodules->load('editprofile_about_top');
echo $tpl->parse("editprofile/about");
} elseif ($_GET['action'] == "pic2") {
$pic = $gpc->get('pic', none);
if ($my->p['usepic'] == 0) {
errorLogin($lang->phrase('not_allowed'), "editprofile.php");
} elseif (isset($_FILES) && is_array($_FILES['upload']) && !empty($_FILES['upload']['name'])) {
require "classes/class.upload.php";
$my_uploader = new uploader();
$my_uploader->max_filesize($config['avfilesize']);
$my_uploader->max_image_size($config['avwidth'], $config['avheight']);
if ($my_uploader->upload('upload', explode('|', $config['avfiletypes']))) {
$my_uploader->save_file('uploads/pics/', '2');
}
if ($my_uploader->return_error()) {
error($my_uploader->return_error(), 'editprofile.php?action=pic');
} else {
if (file_exists($my->pic)) {
@unlink($my->pic);
}
$ext = $my_uploader->rename_file('uploads/pics/', $my_uploader->file['name'], $my->id);
}
$my->pic = 'uploads/pics/' . $my->id . $ext;
} elseif (!empty($pic) && preg_match('/^(http:\\/\\/|www.)([\\wהצ�ִײ�@\\-_\\.]+)\\:?([0-9]*)\\/(.*)$/', $pic, $url_ary)) {
$my->pic = checkRemotePic($pic, $url_ary, $my->id);
} else {
removeOldImages('uploads/pics/', $my->id);
示例4: array
$insertuploads = array();
$inserterrors = array();
require "classes/class.upload.php";
$success = 0;
for ($i = 0; $i < $ups; $i++) {
if (empty($_FILES['upload_' . $i]['name'])) {
continue;
}
$my_uploader = new uploader();
$my_uploader->max_filesize($filesize);
$my_uploader->file_types($filetypes);
$my_uploader->set_path($dir . DIRECTORY_SEPARATOR);
if (isset($imgwidth) && isset($imgheight)) {
$my_uploader->max_image_size($imgwidth, $imgheight);
}
if ($my_uploader->upload('upload_' . $i)) {
$my_uploader->save_file();
}
if ($my_uploader->upload_failed()) {
array_push($inserterrors, $my_uploader->get_error());
}
$file = $dir . DIRECTORY_SEPARATOR . $my_uploader->fileinfo('filename');
if (!file_exists($file)) {
$inserterrors[] = $lang->phrase('admin_explorer_file_does_not_exist');
} else {
$success++;
}
}
echo head();
if ($success == 0) {
$inserterrors[] = $lang->phrase('admin_explorer_no_file_successfully_uploaded');
示例5: array
<?php
include "../../connection/phpmysqlconnect.php";
include "../../lib/CRUD_lib.php";
include "../../lib/miss_lib.php";
// post data
// File processing
$ext_array = array("jpeg", "jpg", "png");
$mime_array = array("image/jpeg", "image/jpg", "image/png");
$location = "../../media/featured_product/";
$image = new uploader();
if ($image->upload_validate($_FILES['files'], $ext_array, $mime_array) == true) {
$image_name = $image->upload($_FILES['files'], $location);
$column = array('logo');
$value = array($image_name);
$insert = new crud($conn, 'featured-product', $column, $value);
$insert->insert();
$move = new alert_redirect();
$move->moveWithAlert('Logo has been added', '../../pages/distributor-logo.php');
}
$move->moveWithAlert('Error in uploading image', '../../pages/distributor-logo.php');
示例6: array
// included files
include "../../../connection/phpmysqlconnect.php";
include "../../../library/CRUD_lib.php";
include "../../../library/miss_lib.php";
// post data
$user_id = $_POST['user_id'];
$month = $_POST['month'];
$year = $_POST['year'];
$modifier = $_SESSION["user"];
// File processing
$ext_array = array("xls", "csv", "xlsx");
$mime_array = array("application/vnd.ms-excel", "text/csv", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
$location = "../../media/performance-sheet/";
$file = new uploader();
if (is_uploaded_file($_FILES['file']['tmp_name'])) {
if ($file->upload_validate($_FILES['file'], $ext_array, $mime_array) == true) {
$file_name = $file->upload($_FILES['file'], $location);
// insertion
$column = array('performance_sheet', 'user_id', 'month', 'year', 'uploaded_by', 'modified_by');
$value = array("{$file_name}", "{$user_id}", "{$month}", "{$year}", "{$modifier}", "{$modifier}");
$insert = new crud($conn, 'employee_performance', $column, $value);
$insert->insert();
$move = new alert_redirect();
$move->moveWithAlert('New Performance Sheet has been added', '../pages/addperformance.php');
} else {
$move = new alert_redirect();
$move->moveWithAlert('File Extension not valid', '../pages/addperformance.php');
}
$move = new alert_redirect();
$move->moveWithAlert('File not uploaded', '../pages/addperformance.php');
}
示例7: uploader
<?php
chdir('../../');
include 'pv_core.php';
CheckLogin();
LoadUserlanguage();
if (isset($_FILES) && count($_FILES) > 0) {
$path = '../' . $Cfg['upload_path'];
require_once 'includes/fileupload-class.php';
$lang = str_replace("_utf8", "", $Users[$Pivot_Vars['user']]['language']);
$my_uploader = new uploader($lang);
// OPTIONAL: set the max filesize of uploadable files in bytes
$my_uploader->max_filesize($Cfg['max_filesize']);
// UPLOAD the file
if ($my_uploader->upload('userfile', $Cfg['upload_accept'], '')) {
$success = $my_uploader->save_file($path, $Cfg['upload_save_mode'], 1);
}
}
if (isset($_GET['f_target'])) {
$target = $_GET['f_target'];
} else {
$target = $_POST['f_target'];
}
if (isset($_GET['f_text'])) {
$text = urldecode($_GET['f_text']);
} else {
$text = $_POST['f_text'];
}
if (!isset($Users[$Pivot_Vars['user']]['wysiwyg'])) {
$useWysiwyg = $Cfg['wysiwyg_editor'] == 1 ? TRUE : FALSE;
} else {
示例8: elseif
} elseif ($job == 'query2') {
echo head();
$type = $gpc->get('type', int);
if ($type == 1) {
$filetypes = array('zip', 'sql');
$dir = 'temp/';
$inserterrors = array();
require "classes/class.upload.php";
if (empty($_FILES['upload']['name'])) {
$inserterrors[] = 'No file specified.';
}
$my_uploader = new uploader();
$my_uploader->max_filesize(ini_maxupload());
$my_uploader->file_types($filetypes);
$my_uploader->set_path($dir);
if ($my_uploader->upload('upload')) {
if ($my_uploader->save_file()) {
$file = $dir . $my_uploader->fileinfo('filename');
if (!file_exists($file)) {
$inserterrors[] = 'File (' . $file . ') does not exist.';
}
}
}
if ($my_uploader->upload_failed()) {
array_push($inserterrors, $my_uploader->get_error());
}
if (count($inserterrors) > 0) {
error('admin.php?action=db&job=query', $inserterrors);
} else {
$ext = get_extension($file);
if (($ext == 'zip' || $ext == 'sql') && file_exists($file)) {
示例9: IN
}
$db->query('DELETE FROM ' . $db->pre . 'uploads WHERE mid = "' . $upinfo['name'] . '" AND id IN (' . implode(',', $ids) . ')', __LINE__, __FILE__);
viscacha_header('Location: attachments.php?type=' . $_GET['type'] . '&id=' . $_GET['id'] . SID2URL_JS_x);
}
} else {
$insertuploads = array();
$inserterrors = array();
require "classes/class.upload.php";
for ($i = 0; $i < $config['tpcmaxuploads']; $i++) {
if (empty($_FILES['upload_' . $i]['name'])) {
continue;
}
$my_uploader = new uploader();
$my_uploader->max_filesize($config['tpcfilesize']);
$my_uploader->max_image_size($config['tpcwidth'], $config['tpcheight']);
if ($my_uploader->upload('upload_' . $i, explode('|', $config['tpcfiletypes']), 1)) {
$my_uploader->save_file('uploads/topics/', '2');
}
if ($my_uploader->return_error()) {
array_push($inserterrors, $my_uploader->return_error());
}
array_push($insertuploads, $my_uploader->file['name']);
}
if (count($inserterrors) > 0) {
error($inserterrors, 'attachments.php?type=' . $_GET['type'] . '&id=' . $_GET['id'] . SID2URL_x);
}
if ($_GET['type'] == 'edit' && ($my->mp[0] == 1 || $upinfo['name'] == $my->id)) {
$upper = $upinfo['name'];
$tid = $upinfo['id'];
} else {
$upper = $my->id;
示例10: fgets
$line = fgets($userfile, 255);
switch ($mode) {
case 1:
echo $line;
break;
case 2:
echo nl2br(ereg_replace("\t", " ", htmlentities($line)));
break;
}
}
}
}
}
$upload = new uploader();
$upload->max_filesize(30000);
if ($upload->upload("{$FILENAME}", "{$ACCEPT}", "{$EXTENSION}")) {
while (list($key, $var) = each($upload->file)) {
echo $key . " = " . $var . "<br>";
}
if ($upload->save_file("{$PATH}", $SAVE_MODE)) {
print "<p>Saved as: " . $upload->new_file . "<p>";
print_file($upload->new_file, $upload->file["type"], 2);
}
}
if ($upload->errors) {
while (list($key, $var) = each($upload->errors)) {
echo "<p>" . $var . "<br>";
}
}
if ($NEW_NAME) {
print "<p>Name of image save: <b>{$NEW_NAME}</b></p>";
示例11: array
}
}
$insertuploads = array();
$inserterrors = array();
require "classes/class.upload.php";
$success = 0;
for ($i = 0; $i < $ups; $i++) {
if (empty($_FILES['upload_' . $i]['name'])) {
continue;
}
$my_uploader = new uploader();
$my_uploader->max_filesize($filesize);
if (isset($imgwidth) && isset($imgheight)) {
$my_uploader->max_image_size($imgwidth, $imgheight);
}
if ($my_uploader->upload('upload_' . $i, $filetypes)) {
$my_uploader->save_file($dir, 2);
$errstr = $my_uploader->return_error();
if (!empty($errstr)) {
array_push($inserterrors, $my_uploader->return_error());
}
} else {
array_push($inserterrors, $my_uploader->return_error());
}
$file = $dir . DIRECTORY_SEPARATOR . $my_uploader->file['name'];
if (!file_exists($file)) {
$inserterrors[] = 'File (' . $file . ') does not exist.';
} else {
$success++;
}
}
示例12: uploader
// 저장 옵션:
// 1 = 같은 이름의 파일이 존재 하면 덮어 씁니다.
// 2 = 같은 이름의 파일이 존재할 경우, 파일 이름 뒤에 _copy,jpg, _copy1.jpg ... 식으로 이름을 붙입니다.
// 3 = 같은 이름의 파일이 존재할 경우, 업로드하지 않습니다.
//
define('SAVE_OPTION', 2);
if ($_REQUEST['do'] == "submit") {
require_once "imageupload-class.php";
$attach = new uploader();
//////////////////////////////////////////////////////////////////////////
// 옵션:
//
// $attach->max_filesize(102400); // 이미지 업로드 최대 크기
// $attach->max_image_size(1024, 1024); // 이미지 가로, 세로 최대 픽셀 크기
$attach->max_image_size(8096, 8096);
$success = $attach->upload("AttachFile", ALLOW_FORMAT, "");
if ($success) {
$success = $attach->save_file(SAVE_AS_DIRECTORY, SAVE_OPTION);
$filename = SAVE_AS_URL . $attach->file['name'];
echo '<script type="text/javascript">';
echo 'var obj = parent.window.insert_form;';
echo 'obj.attachSuccess(\'' . $filename . '\');';
echo '</script>';
} else {
if ($attach->errors) {
$msg = '';
while (list($k, $v) = each($attach->errors)) {
$msg .= $v;
}
echo '<script type="text/javascript">';
echo 'alert(\'' . $msg . '\');';
示例13: date
//print_r($import_info);
}
}
$var = "";
}
$now = date("U");
$add_log = mysql_query("INSERT INTO amx_logs (timestamp, ip, username, action, remarks) VALUES ('{$now}', '" . $_SERVER['REMOTE_ADDR'] . "', '" . $_SESSION['uid'] . "', 'import ban', 'imported bans: {$j}')") or die(mysql_error());
return $import_array;
}
if (isset($_POST['en'])) {
$my_uploader = new uploader($_POST['en']);
} else {
$my_uploader = new uploader("en");
}
$my_uploader->max_filesize(45000);
if ($my_uploader->upload($upload_file_name, $acceptable_file_types, $default_extension)) {
$my_uploader->save_file($path, $mode);
}
if ($my_uploader->error) {
//echo $my_uploader->error . "<br><br>\n";
} else {
$import_array = ban_file($my_uploader->file['name']);
}
}
if (isset($acceptable_file_types) && trim($acceptable_file_types)) {
$submit = "This form only accepts <b>" . str_replace("|", " or ", $acceptable_file_types) . "</b> files <input type='submit' name='importit' value='" . lang("_IMPORT") . "' style='font-family: verdana, tahoma, arial; font-size: 10px;'>";
} else {
$submit = "No acceptable filetypes set. <input type='submit' name='importit' value='" . lang("_IMPORT") . "' style='font-family: verdana, tahoma, arial; font-size: 10px;' disabled>";
}
/****************************************************************
* Template parsing
示例14: uploadfile
/**
* Upload a file
*
*/
function uploadfile()
{
global $Cfg, $Paths, $Users, $Pivot_Vars, $qual, $local;
MinLevel(2);
include_once 'includes/fileupload-class.php';
$lang = str_replace("_utf8", "", $Users[$Pivot_Vars['user']]['language']);
$my_uploader = new uploader($lang);
// OPTIONAL: set the max filesize of uploadable files in bytes
$my_uploader->max_filesize($Cfg['max_filesize']);
// UPLOAD the file
if ($my_uploader->upload('userfile', $Cfg['upload_accept'], $Cfg['upload_extension'])) {
debug($my_uploader->file['name']);
$success = $my_uploader->save_file($Paths['upload_path'], $Cfg['upload_save_mode'], 1);
}
if ($success) {
error_reporting(E_ALL);
include_once "modules/module_imagefunctions.php";
PageHeader(lang('userbar', 'main'), 1);
PageAnkeiler(lang('userbar', 'files') . ' » ' . lang('userbar', 'uploaded_success'));
printf('<script type="text/javascript">function pop(a){
window.open("modules/module_image.php?image="+a,"",
"toolbar=no,resizable=yes,scrollbars=yes,width=940,height=570");
self.location="index.php?menu=files";}
</script>');
echo '<tr><td align="center" colspan="2">';
$fullentry = $Paths['upload_url'] . $my_uploader->file['name'];
echo '<img src="' . $fullentry . '" border="0" alt="new image">';
echo '</td></tr><tr><td align="right" width="48%"><br /><br />';
if (auto_thumbnail($my_uploader->file['name'])) {
echo "<p><b>Thumbnail:</b><br>";
$thumbfilename = $Paths['upload_url'] . make_thumbname(basename($my_uploader->file['name']));
printf('<p><img src="%s" />', $thumbfilename);
printf('<p><a href="javascript:pop(\'%s\')">' . lang('upload', 'edit_thumbnail') . '</a></td>', $my_uploader->file['name']);
} else {
printf('<p><a href="javascript:pop(\'%s\');">' . lang('upload', 'create_thumb') . '</a></td>', $my_uploader->file['name']);
}
GenSetting('', lang('upload', 'thisfile'), '', 8, '', 6);
StartForm('file_upload', 0, 'enctype="multipart/form-data"');
printf('<input name="%s" type="file" class="input"><br />', $Cfg['upload_file_name']);
printf('<input type="submit" value="%s" class="button" /></form>', lang('upload', 'button'));
PageFooter();
} else {
if ($my_uploader->errors) {
files_main($my_uploader->errors);
}
}
}
示例15: implode
}
$filesystem->file_put_contents('data/feedcreator.inc.php', implode("\n", $n));
}
viscacha_header('Location: admin.php?action=misc&job=feedcreator');
} elseif ($job == 'feedcreator_add') {
echo head();
$name = $gpc->get('name', str);
$class = $gpc->get('class', str);
$active = $gpc->get('active', str);
$dl = $gpc->get('dl', str);
$dir = realpath('./classes/feedcreator/');
$inserterrors = array();
require "classes/class.upload.php";
$my_uploader = new uploader();
$my_uploader->max_filesize(200 * 1024);
if ($my_uploader->upload('upload', array('.php'))) {
if (strlen($my_uploader->return_error()) > 0) {
array_push($inserterrors, $my_uploader->return_error());
}
$my_uploader->save_file($dir, 2);
$file = $my_uploader->file['name'];
} else {
if (strlen($my_uploader->return_error()) > 0) {
array_push($inserterrors, $my_uploader->return_error());
} else {
if (count($inserterrors) == 0) {
array_push($inserterrors, 'An unexpected error occurred');
}
}
}
if (count($inserterrors) > 0) {