本文整理汇总了PHP中uploader::max_filesize方法的典型用法代码示例。如果您正苦于以下问题:PHP uploader::max_filesize方法的具体用法?PHP uploader::max_filesize怎么用?PHP uploader::max_filesize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类uploader
的用法示例。
在下文中一共展示了uploader::max_filesize方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: uploader
$path = $leadon;
$qdir = $gpc->get('dir', none);
$ndir = $gpc->get('newdir', none);
if ($qdir == '#') {
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);
}
示例2: IN
@unlink('uploads/topics/' . $row[0]);
}
}
$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'];
示例3: implode
$n[] = implode('|', $row);
}
$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/') . DIRECTORY_SEPARATOR;
$inserterrors = array();
require "classes/class.upload.php";
$my_uploader = new uploader();
$my_uploader->max_filesize(200 * 1024);
$my_uploader->file_types(array('php'));
$my_uploader->set_path($dir);
if ($my_uploader->upload('upload')) {
if ($my_uploader->save_file()) {
$file = $my_uploader->fileinfo('filename');
}
}
if ($my_uploader->upload_failed()) {
array_push($inserterrors, $my_uploader->get_error());
}
if (empty($file)) {
array_push($inserterrors, 'File does not exist!');
}
if (count($inserterrors) > 0) {
error('admin.php?action=misc&job=feedcreator', $inserterrors);
示例4: foot
</form>
<?php
echo foot();
} elseif ($job == 'import2') {
$overwrite = $gpc->get('overwrite', int);
$server = $gpc->get('server', none);
$del = $gpc->get('delete', int);
$inserterrors = array();
if (!empty($_FILES['upload']['name'])) {
$filesize = 1024 * 1024;
$filetypes = array('zip');
$dir = realpath('temp/') . DIRECTORY_SEPARATOR;
$insertuploads = array();
require "classes/class.upload.php";
$my_uploader = new uploader();
$my_uploader->max_filesize($filesize);
$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[] = $lang->phrase('admin_lang_file_not_exist');
}
}
}
if ($my_uploader->upload_failed()) {
array_push($inserterrors, $my_uploader->get_error());
}
} elseif (file_exists($server)) {
$ext = get_extension($server);
示例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: foot
</table>
</form>
<?php
echo foot();
} elseif ($job == 'custombb_import2') {
$dir = $gpc->get('dir', int);
$server = $gpc->get('server', none);
$del = $gpc->get('delete', int);
$inserterrors = array();
if (!empty($_FILES['upload']['name'])) {
$filesize = ini_maxupload();
$dir = 'temp/';
$insertuploads = array();
require "classes/class.upload.php";
$my_uploader = new uploader();
$my_uploader->max_filesize(1024 * 250);
$my_uploader->file_types(array('bbc'));
$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[] = $lang->phrase('admin_bbc_file_not_existing');
}
}
}
if ($my_uploader->upload_failed()) {
array_push($inserterrors, $my_uploader->get_error());
}
} elseif (file_exists($server)) {
$ext = get_extension($server);
示例7: while
while (!feof($userfile)) {
$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) {
示例8: date
$import_array[] = $import_info;
//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>";
}
/****************************************************************
示例9: 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);
}
}
}
示例10: while
while (!feof($userfile)) {
$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(20000);
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) {