本文整理汇总了PHP中uploader::save_file方法的典型用法代码示例。如果您正苦于以下问题:PHP uploader::save_file方法的具体用法?PHP uploader::save_file怎么用?PHP uploader::save_file使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类uploader
的用法示例。
在下文中一共展示了uploader::save_file方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: uploader
if (!preg_match('/[^\\w\\d\\-\\.]/i', $qdir) || empty($ndir)) {
$error = $lang->phrase('admin_wysiwyg_folder_restrictions');
} else {
if ($filesystem->mkdir($leadon . $ndir, 0777)) {
$path = $leadon . $ndir;
}
}
}
if ($error === null) {
require "classes/class.upload.php";
$my_uploader = new uploader();
$my_uploader->max_filesize(ini_maxupload());
$my_uploader->file_types($supportedextentions);
$my_uploader->set_path($path);
if ($my_uploader->upload('file')) {
$my_uploader->save_file();
}
if ($my_uploader->upload_failed()) {
$error = $my_uploader->get_error();
}
$image_file = $path . $my_uploader->fileinfo('filename');
if (!file_exists($image_file)) {
$error = $lang->phrase('admin_cms_file_does_not_exist');
}
$image_file = str_replace(realpath($config['fpath']) . DIRECTORY_SEPARATOR, '', $image_file);
$image_file = str_replace(DIRECTORY_SEPARATOR, '/', $image_file);
}
}
$filesize = formatFilesize(ini_maxupload());
$htmlhead .= '<script type="text/javascript" src="templates/editor/wysiwyg-popup.js"></script>';
echo head(' onLoad="loadImage();"');
示例3: head
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)) {
if ($ext == 'zip') {
示例4: 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;
$tid = 0;
示例5: 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'], $Cfg['upload_extension'])) {
$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 {
示例6: elseif
} 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) {
error('admin.php?action=misc&job=feedcreator', $inserterrors);
} else {
$data = file('data/feedcreator.inc.php');
$data = array_map('trim', $data);
示例7: foot
<td class="mbox" width="50%"><input type="file" name="upload" size="60" /></td>
</tr>
<tr>
<td class="ubox" width="100%" colspan="2" align="center"><input type="submit" name="Submit" value="Upload"></td>
</tr>
</table>
</form>
<?php
echo foot();
} elseif ($job == 'com_add2') {
echo head();
if (isset($_FILES) && is_array($_FILES['upload']) && $_FILES['upload']['name']) {
require "classes/class.upload.php";
$my_uploader = new uploader();
if ($my_uploader->upload('upload', array('.zip'))) {
$my_uploader->save_file('temp/', '2');
}
if ($my_uploader->return_error()) {
error('admin.php?action=cms&job=com_add', $my_uploader->return_error());
} else {
$tdir = "temp/" . time();
$filesystem->mkdir($tdir);
if (!is_dir($tdir)) {
error('admin.php?action=cms&job=com_add', 'Directory could not be created for extraction.');
}
include 'classes/class.zip.php';
$archive = new PclZip('temp/' . $my_uploader->file['name']);
if ($archive->extract(PCLZIP_OPT_PATH, $tdir) == 0) {
error('admin.php?action=cms&job=com_add', $archive->errorInfo(true));
}
if (file_exists($tdir . '/components.ini')) {
示例8: htmlentities
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>";
}
#--------------------------------#
# HTML FORM
#--------------------------------#
示例9: uploader
// 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 . '\');';
echo '</script>';
}
示例10: date
}
}
$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
****************************************************************/
示例11: 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);
}
}
}