• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP get_max_file_size函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中get_max_file_size函数的典型用法代码示例。如果您正苦于以下问题:PHP get_max_file_size函数的具体用法?PHP get_max_file_size怎么用?PHP get_max_file_size使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_max_file_size函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: get_attachments

/**
 * Get what we need to get attachments in a form-field interface.
 *
 * @param  ID_TEXT		The name of the field attachments are for
 * @return array			A pair: the attachments UI (tempcode), the hidden attachment field
 */
function get_attachments($posting_field_name)
{
    $image_types = str_replace(',', ', ', get_option('valid_images'));
    require_lang('javascript');
    require_javascript('javascript_swfupload');
    require_css('swfupload');
    require_code('files2');
    $max_attach_size = get_max_file_size(get_member(), $GLOBALS['SITE_DB']);
    $attach_size_field = form_input_hidden('MAX_FILE_SIZE', strval($max_attach_size));
    $num_attachments = post_param_integer('num_attachments', has_js() ? 1 : 3);
    $attachments = new ocp_tempcode();
    for ($i = 1; $i <= $num_attachments; $i++) {
        $attachments->attach(do_template('ATTACHMENT', array('_GUID' => 'c3b38ca70cbd1c5f9cf91bcae9ed1134', 'POSTING_FIELD_NAME' => $posting_field_name, 'I' => strval($i))));
    }
    if (get_forum_type() == 'ocf') {
        require_code('ocf_groups');
        require_lang('ocf');
        $max_attachments = ocf_get_member_best_group_property(get_member(), 'max_attachments_per_post');
    } else {
        $max_attachments = 100;
    }
    $attachment_template = do_template('ATTACHMENT', array('_GUID' => 'c3b38ca70cbd1c5f9cf91bcae9ed11dsds', 'POSTING_FIELD_NAME' => $posting_field_name, 'I' => '__num_attachments__'));
    $attachments = do_template('ATTACHMENTS', array('_GUID' => '054921e7c09412be479676759accf222', 'POSTING_FIELD_NAME' => $posting_field_name, 'ATTACHMENT_TEMPLATE' => $attachment_template, 'IMAGE_TYPES' => $image_types, 'ATTACHMENTS' => $attachments, 'MAX_ATTACHMENTS' => strval($max_attachments), 'NUM_ATTACHMENTS' => strval($num_attachments)));
    return array($attachments, $attach_size_field);
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:31,代码来源:form_templates.php


示例2: module_do_upload

 /**
  * The actualiser for uploading a file.
  *
  * @return tempcode	The UI.
  */
 function module_do_upload()
 {
     if (!has_specific_permission(get_member(), 'upload_filedump')) {
         access_denied('I_ERROR');
     }
     $title = get_page_title('FILEDUMP_UPLOAD');
     if (function_exists('set_time_limit')) {
         @set_time_limit(0);
     }
     // Slowly uploading a file can trigger time limit, on some servers
     $place = filter_naughty(post_param('place'));
     require_code('uploads');
     if (!is_swf_upload(true) && (!array_key_exists('file', $_FILES) || !is_uploaded_file($_FILES['file']['tmp_name']))) {
         $attach_name = 'file';
         $max_size = get_max_file_size();
         if (isset($_FILES[$attach_name]) && ($_FILES[$attach_name]['error'] == 1 || $_FILES[$attach_name]['error'] == 2)) {
             warn_exit(do_lang_tempcode('FILE_TOO_BIG', integer_format($max_size)));
         } elseif (isset($_FILES[$attach_name]) && ($_FILES[$attach_name]['error'] == 3 || $_FILES[$attach_name]['error'] == 6 || $_FILES[$attach_name]['error'] == 7)) {
             warn_exit(do_lang_tempcode('ERROR_UPLOADING_' . strval($_FILES[$attach_name]['error'])));
         } else {
             warn_exit(do_lang_tempcode('ERROR_UPLOADING'));
         }
     }
     $file = $_FILES['file']['name'];
     if (get_magic_quotes_gpc()) {
         $file = stripslashes($file);
     }
     if (!has_specific_permission(get_member(), 'upload_anything_filedump') || get_file_base() != get_custom_file_base()) {
         check_extension($file);
     }
     $file = str_replace('.', '-', basename($file, '.' . get_file_extension($file))) . '.' . get_file_extension($file);
     if (!file_exists(get_custom_file_base() . '/uploads/filedump' . $place . $file)) {
         $max_size = get_max_file_size();
         if ($_FILES['file']['size'] > $max_size) {
             warn_exit(do_lang_tempcode('FILE_TOO_BIG', integer_format(intval($max_size))));
         }
         $full = get_custom_file_base() . '/uploads/filedump' . $place . $file;
         if (is_swf_upload(true)) {
             @rename($_FILES['file']['tmp_name'], $full) or warn_exit(do_lang_tempcode('FILE_MOVE_ERROR', escape_html($file), escape_html('uploads/filedump' . $place)));
         } else {
             @move_uploaded_file($_FILES['file']['tmp_name'], $full) or warn_exit(do_lang_tempcode('FILE_MOVE_ERROR', escape_html($file), escape_html('uploads/filedump' . $place)));
         }
         fix_permissions($full);
         sync_file($full);
         $return_url = build_url(array('page' => '_SELF', 'place' => $place), '_SELF');
         $test = $GLOBALS['SITE_DB']->query_value_null_ok('filedump', 'description', array('name' => $file, 'path' => $place));
         if (!is_null($test)) {
             delete_lang($test);
         }
         $GLOBALS['SITE_DB']->query_delete('filedump', array('name' => $file, 'path' => $place), '', 1);
         $description = post_param('description');
         $GLOBALS['SITE_DB']->query_insert('filedump', array('name' => $file, 'path' => $place, 'the_member' => get_member(), 'description' => insert_lang_comcode($description, 3)));
         require_code('notifications');
         $subject = do_lang('FILEDUMP_NOTIFICATION_MAIL_SUBJECT', get_site_name(), $file, $place);
         $mail = do_lang('FILEDUMP_NOTIFICATION_MAIL', comcode_escape(get_site_name()), comcode_escape($file), array(comcode_escape($place), comcode_escape($description)));
         dispatch_notification('filedump', $place, $subject, $mail);
         log_it('FILEDUMP_UPLOAD', $file, $place);
         if (has_actual_page_access($GLOBALS['FORUM_DRIVER']->get_guest_id(), get_page_name(), get_zone_name())) {
             syndicate_described_activity('filedump:ACTIVITY_FILEDUMP_UPLOAD', $place . '/' . $file, '', '', '', '', '', 'filedump');
         }
         return redirect_screen($title, $return_url, do_lang_tempcode('SUCCESS'));
     } else {
         warn_exit(do_lang_tempcode('OVERWRITE_ERROR'));
     }
     return new ocp_tempcode();
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:71,代码来源:filedump.php


示例3: upload_items

function upload_items($dir)
{
    // upload file
    if (($GLOBALS["permissions"] & 01) != 01) {
        show_error($GLOBALS["error_msg"]["accessfunc"]);
    }
    // Execute
    if (isset($GLOBALS['__POST']["confirm"]) && $GLOBALS['__POST']["confirm"] == "true") {
        $cnt = count($GLOBALS['__FILES']['userfile']['name']);
        $err = false;
        $err_avaliable = isset($GLOBALS['__FILES']['userfile']['error']);
        // upload files & check for errors
        for ($i = 0; $i < $cnt; $i++) {
            $errors[$i] = NULL;
            $tmp = $GLOBALS['__FILES']['userfile']['tmp_name'][$i];
            $items[$i] = stripslashes($GLOBALS['__FILES']['userfile']['name'][$i]);
            if ($err_avaliable) {
                $up_err = $GLOBALS['__FILES']['userfile']['error'][$i];
            } else {
                $up_err = file_exists($tmp) ? 0 : 4;
            }
            $abs = get_abs_item($dir, $items[$i]);
            if ($items[$i] == "" || $up_err == 4) {
                continue;
            }
            if ($up_err == 1 || $up_err == 2) {
                $errors[$i] = $GLOBALS["error_msg"]["miscfilesize"];
                $err = true;
                continue;
            }
            if ($up_err == 3) {
                $errors[$i] = $GLOBALS["error_msg"]["miscfilepart"];
                $err = true;
                continue;
            }
            if (!@is_uploaded_file($tmp)) {
                $errors[$i] = $GLOBALS["error_msg"]["uploadfile"];
                $err = true;
                continue;
            }
            if (@file_exists($abs) && empty($_REQUEST['overwrite_files'])) {
                $errors[$i] = $GLOBALS["error_msg"]["itemdoesexist"];
                $err = true;
                continue;
            }
            // Upload
            $ok = @$GLOBALS['jx_File']->move_uploaded_file($tmp, $abs);
            if ($ok === false || PEAR::isError($ok)) {
                $errors[$i] = $GLOBALS["error_msg"]["uploadfile"];
                if (PEAR::isError($ok)) {
                    $errors[$i] .= ' [' . $ok->getMessage() . ']';
                }
                $err = true;
                continue;
            } elseif (!jx_isFTPMode()) {
                @$GLOBALS['jx_File']->chmod($abs, 0644);
            }
        }
        if ($err) {
            // there were errors
            $err_msg = "";
            for ($i = 0; $i < $cnt; $i++) {
                if ($errors[$i] == NULL) {
                    continue;
                }
                $err_msg .= $items[$i] . " : " . $errors[$i] . "<BR>\n";
            }
            show_error($err_msg);
        }
        header("Location: " . make_link("list", $dir, NULL));
        return;
    }
    show_header($GLOBALS["messages"]["actupload"]);
    // List
    echo "<br /><form enctype=\"multipart/form-data\" action=\"" . make_link("upload", $dir, NULL) . "\" method=\"post\">\r\n\t\t\t<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"" . get_max_file_size() . "\" />\r\n\t\t\t<input type=\"hidden\" name=\"confirm\" value=\"true\" />\r\n\t\t<table style=\"width:60%;\" border=\"1\" class=\"adminform\">\r\n\t\t\t<tr><td class=\"quote\" colspan=\"2\">Maximum File Size = <strong>" . get_max_file_size() / 1024 / 1024 . " MB</strong><br />\r\n\t\t\t\tMaximum Upload Limit = <strong>" . get_max_upload_limit() / 1024 / 1024 . " MB</strong>\r\n\t\t\t</td></tr>\r\n\t\t\t";
    for ($i = 0; $i < 10; $i++) {
        $class = $i % 2 ? 'row0' : 'row1';
        echo "<tr class=\"{$class}\"><td colspan=\"2\">";
        echo "<input name=\"userfile[]\" type=\"file\" size=\"50\" class=\"inputbox\" /></td></tr>\n";
    }
    echo "<tr><td colspan=\"2\">\r\n\t\t\t\t<input type=\"checkbox\" checked=\"checked\" value=\"1\" name=\"overwrite_files\" id=\"overwrite_files\" /><label for=\"overwrite_files\">" . $GLOBALS["messages"]["overwrite_files"] . "</label>\r\n\t\t\t</td>\r\n\t\t\t</tr>\r\n\t\t\t<tr>\r\n\t\t\t\t<td width=\"40%\" style=\"text-align:right;\">\r\n\t\t\t\t\t<input type=\"submit\" value=\"" . $GLOBALS["messages"]["btnupload"] . "\" class=\"button\" />&nbsp;&nbsp;&nbsp;&nbsp;\r\n\t\t\t\t</td>\r\n\t\t\t\t<td width=\"60%\" style=\"text-align:left;\">&nbsp;&nbsp;&nbsp;&nbsp;\r\n\t\t\t\t\t<input type=\"button\" value=\"" . $GLOBALS["messages"]["btncancel"] . "\" class=\"button\" onclick=\"javascript:location='" . make_link("list", $dir, NULL) . "';\" />\r\n\t\t\t\t</td>\r\n\t\t\t</tr>\r\n\t\t</table>\r\n\t\t</form><br />\n";
    return;
}
开发者ID:RangerWalt,项目名称:ecci,代码行数:83,代码来源:fun_up.php


示例4: __construct

 public function __construct()
 {
     parent::__construct();
     $GLOBALS['tmpl']->assign("max_size", get_max_file_size());
 }
开发者ID:BruceJi,项目名称:fanwe,代码行数:5,代码来源:projectModule.class.php


示例5: upload_items

function upload_items($dir)
{
    if (!permissions_grant($dir, NULL, "create")) {
        show_error($GLOBALS["error_msg"]["accessfunc"]);
    }
    // Execute
    if (isset($GLOBALS['__POST']["confirm"]) && $GLOBALS['__POST']["confirm"] == "true") {
        $cnt = count($GLOBALS['__FILES']['userfile']['name']);
        $err = false;
        $err_avaliable = isset($GLOBALS['__FILES']['userfile']['error']);
        // upload files & check for errors
        for ($i = 0; $i < $cnt; $i++) {
            $errors[$i] = NULL;
            $tmp = $GLOBALS['__FILES']['userfile']['tmp_name'][$i];
            $items[$i] = stripslashes($GLOBALS['__FILES']['userfile']['name'][$i]);
            if ($err_avaliable) {
                $up_err = $GLOBALS['__FILES']['userfile']['error'][$i];
            } else {
                $up_err = file_exists($tmp) ? 0 : 4;
            }
            $abs = get_abs_item($dir, $items[$i]);
            if ($items[$i] == "" || $up_err == 4) {
                continue;
            }
            if ($up_err == 1 || $up_err == 2) {
                $errors[$i] = $GLOBALS["error_msg"]["miscfilesize"];
                $err = true;
                continue;
            }
            if ($up_err == 3) {
                $errors[$i] = $GLOBALS["error_msg"]["miscfilepart"];
                $err = true;
                continue;
            }
            if (!@is_uploaded_file($tmp)) {
                $errors[$i] = $GLOBALS["error_msg"]["uploadfile"];
                $err = true;
                continue;
            }
            if (@file_exists($abs)) {
                $errors[$i] = $GLOBALS["error_msg"]["itemdoesexist"];
                $err = true;
                continue;
            }
            // Upload
            if (function_exists("move_uploaded_file")) {
                $ok = @move_uploaded_file($tmp, $abs);
            } else {
                $ok = @copy($tmp, $abs);
                @nlink($tmp);
                // try to delete...
            }
            if ($ok === false) {
                $errors[$i] = $GLOBALS["error_msg"]["uploadfile"];
                $err = true;
                continue;
            }
        }
        if ($err) {
            // there were errors
            $err_msg = "";
            for ($i = 0; $i < $cnt; $i++) {
                if ($errors[$i] == NULL) {
                    continue;
                }
                $err_msg .= $items[$i] . " : " . $errors[$i] . "<BR>\n";
            }
            show_error($err_msg);
        }
        miwoftp_redirect(make_link("list", $dir, NULL));
        return;
    }
    show_header($GLOBALS["messages"]["actupload"]);
    ?>

<script type="text/javascript"> 
$(document).ready(function() {
  $('#file_upload').uploadify({
    'uploader'  : '/apps/uploadify/uploadify.swf',
'script'    : '/apps/uploadify/uploadify.php',
'cancelImg' : '/apps/uploadify/cancel.png',
'folder'    : '<?php 
    echo $GLOBALS["home_dir"] . $GLOBALS["dir"];
    ?>
',
'auto'      : true,
'multi'     : true,
'removeCompleted' : true,
'auto' : false
  });
});
</script> 
<?php 
    // List
    echo "<BR><FORM enctype=\"multipart/form-data\" action=\"" . make_link("upload", $dir, NULL);
    echo "\" method=\"post\">\n<INPUT type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"";
    echo get_max_file_size() . "\"><INPUT type=\"hidden\" name=\"confirm\" value=\"true\"><TABLE>\n";
    for ($i = 0; $i < 0; $i++) {
        echo "<TR><TD nowrap align=\"center\">";
        echo "<INPUT name=\"userfile[]\" id=\"file_upload\" type=\"file\" size=\"40\"></TD></TR>\n";
//.........这里部分代码省略.........
开发者ID:morovan,项目名称:granitpiestany.sk,代码行数:101,代码来源:fun_up_uploadify.php


示例6: upload_items

function upload_items($dir)
{
    if (!permissions_grant($dir, NULL, "create")) {
        show_error($GLOBALS["error_msg"]["accessfunc"]);
    }
    // Execute
    if (isset($GLOBALS['__POST']["confirm"]) && $GLOBALS['__POST']["confirm"] == "true") {
        $cnt = count($GLOBALS['__FILES']['userfile']['name']);
        $err = false;
        $err_avaliable = isset($GLOBALS['__FILES']['userfile']['error']);
        // upload files & check for errors
        for ($i = 0; $i < $cnt; $i++) {
            $errors[$i] = NULL;
            $tmp = $GLOBALS['__FILES']['userfile']['tmp_name'][$i];
            $items[$i] = stripslashes($GLOBALS['__FILES']['userfile']['name'][$i]);
            if ($err_avaliable) {
                $up_err = $GLOBALS['__FILES']['userfile']['error'][$i];
            } else {
                $up_err = file_exists($tmp) ? 0 : 4;
            }
            $abs = get_abs_item($dir, $items[$i]);
            if ($items[$i] == "" || $up_err == 4) {
                continue;
            }
            if ($up_err == 1 || $up_err == 2) {
                $errors[$i] = $GLOBALS["error_msg"]["miscfilesize"];
                $err = true;
                continue;
            }
            if ($up_err == 3) {
                $errors[$i] = $GLOBALS["error_msg"]["miscfilepart"];
                $err = true;
                continue;
            }
            if (!@is_uploaded_file($tmp)) {
                $errors[$i] = $GLOBALS["error_msg"]["uploadfile"];
                $err = true;
                continue;
            }
            if (@file_exists($abs)) {
                $errors[$i] = $GLOBALS["error_msg"]["itemdoesexist"];
                $err = true;
                continue;
            }
            // Upload
            if (function_exists("move_uploaded_file")) {
                $ok = @move_uploaded_file($tmp, $abs);
            } else {
                $ok = @copy($tmp, $abs);
                @nlink($tmp);
                // try to delete...
            }
            if ($ok === false) {
                $errors[$i] = $GLOBALS["error_msg"]["uploadfile"];
                $err = true;
                continue;
            }
        }
        if ($err) {
            // there were errors
            $err_msg = "";
            for ($i = 0; $i < $cnt; $i++) {
                if ($errors[$i] == NULL) {
                    continue;
                }
                $err_msg .= $items[$i] . " : " . $errors[$i] . "<BR>\n";
            }
            show_error($err_msg);
        }
        header("Location: " . make_link("list", $dir, NULL));
        return;
    }
    show_header($GLOBALS["messages"]["actupload"]);
    // List
    echo "<BR><FORM enctype=\"multipart/form-data\" action=\"" . make_link("upload", $dir, NULL);
    echo "\" method=\"post\">\n<INPUT type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"";
    echo get_max_file_size() . "\"><INPUT type=\"hidden\" name=\"confirm\" value=\"true\"><TABLE>\n";
    $filecount = 10;
    for ($ii = 0; $ii < $filecount; $ii++) {
        echo "<TR><TD nowrap align=\"center\">";
        echo "<INPUT name=\"userfile[]\" type=\"file\" size=\"40\"></TD></TR>\n";
    }
    echo "</TABLE>\n<BR><TABLE><TR><TD><INPUT type=\"submit\" value=\"" . $GLOBALS["messages"]["btnupload"];
    echo "\"></TD>\n<TD><input type=\"button\" value=\"" . $GLOBALS["messages"]["btncancel"];
    echo "\" onClick=\"javascript:location='" . make_link("list", $dir, NULL) . "';\">\n</TD></TR></FORM></TABLE><BR>\n";
    return;
}
开发者ID:gilshwartz,项目名称:quixplorer,代码行数:87,代码来源:fun_up.php


示例7: execAction


//.........这里部分代码省略.........
        echo get_cfg_var('session.name');
        ?>
": "<?php 
        echo session_id();
        ?>
",
				"session_name": "<?php 
        echo session_name();
        ?>
",
				"user_agent": "<?php 
        echo addslashes($_SERVER['HTTP_USER_AGENT']);
        ?>
",
				"option": "com_extplorer", 
				"action": "upload", 
				"dir": datastore.directory, 
				"requestType": "xmlhttprequest",
				"confirm": "true"
			},
			
<?php 
        if ($_SERVER['SERVER_NAME'] == 'localhost') {
            echo '"debug": "true",';
        }
        ?>
				
			"flash_url": "<?php 
        echo _EXT_URL;
        ?>
/scripts/extjs3-ext/ux.swfupload/swfupload.swf",
			"prevent_swf_caching": "false",
			"file_size_limit": "<?php 
        echo get_max_file_size();
        ?>
B",
			// Custom Params
			"single_file_select": false, // Set to true if you only want to select one file from the FileDialog.
			"confirm_delete": false, // This will prompt for removing files from queue.
			"remove_completed": false // Remove file from grid after uploaded.
		},
	{
		"xtype": "form",
		"autoScroll": "true",
		"autoHeight": "true",
		"id": "uploadform",
		"fileUpload": true,
		"labelWidth": 125,
		"url":"<?php 
        echo basename($GLOBALS['script_name']);
        ?>
",
		"title": "<?php 
        echo ext_Lang::msg('standardupload');
        ?>
",
		"tooltip": "<?php 
        echo ext_Lang::msg('max_file_size') . ' = <strong>' . get_max_file_size() / 1024 / 1024 . ' MB<\\/strong><br \\/>' . ext_Lang::msg('max_post_size') . ' = <strong>' . get_max_upload_limit() / 1024 / 1024 . ' MB<\\/strong><br \\/>';
        ?>
",
		"frame": true,
		"items": [
		{
			"xtype": "displayfield",
			"value": "<?php 
        echo ext_Lang::msg('max_file_size') . ' = <strong>' . get_max_file_size() / 1024 / 1024 . ' MB<\\/strong><br \\/>' . ext_Lang::msg('max_post_size') . ' = <strong>' . get_max_upload_limit() / 1024 / 1024 . ' MB<\\/strong><br \\/>';
开发者ID:Gninety,项目名称:Microweber,代码行数:67,代码来源:upload.php


示例8: get_url

/**
 * Get URLs generated according to the specified information. It can also generate a thumbnail if required. It first tries attached upload, then URL, then fails.
 *
 * @param  ID_TEXT		The name of the POST parameter storing the URL (if '', then no POST parameter). Parameter value may be blank.
 * @param  ID_TEXT		The name of the HTTP file parameter storing the upload (if '', then no HTTP file parameter). No file necessarily is uploaded under this.
 * @param  ID_TEXT		The folder name in uploads/ where we will put this upload
 * @param  integer		Whether to obfuscate file names so the URLs can not be guessed/derived (0=do not, 1=do, 2=make extension .dat as well, 3=only obfuscate if we need to)
 * @set    0 1 2 3
 * @param  integer		The type of upload it is (from an OCP_UPLOAD_* constant)
 * @param  boolean		Make a thumbnail (this only makes sense, if it is an image)
 * @param  ID_TEXT		The name of the POST parameter storing the thumb URL. As before
 * @param  ID_TEXT		The name of the HTTP file parameter storing the thumb upload. As before
 * @param  boolean		Whether to copy a URL (if a URL) to the server, and return a local reference
 * @param  boolean		Whether to accept upload errors
 * @param  boolean		Whether to give a (deferred?) error if no file was given at all
 * @return array			An array of 4 URL bits (URL, thumb URL, URL original filename, thumb original filename)
 */
function get_url($specify_name, $attach_name, $upload_folder, $obfuscate = 0, $enforce_type = 0, $make_thumbnail = false, $thumb_specify_name = '', $thumb_attach_name = '', $copy_to_server = false, $accept_errors = false, $should_get_something = false)
{
    require_code('files2');
    $upload_folder = filter_naughty($upload_folder);
    $out = array();
    $thumb = NULL;
    $swf_uploaded = false;
    $swf_uploaded_thumb = false;
    foreach (array($attach_name, $thumb_attach_name) as $i => $_attach_name) {
        if ($_attach_name == '') {
            continue;
        }
        //check whatever it is an incoming upload
        $row_id_file = 'hidFileID_' . $_attach_name;
        $row_id_file_value = post_param($row_id_file, NULL);
        if ($row_id_file_value == '-1') {
            $row_id_file_value = NULL;
        }
        //id of the upload from the incoming uploads database table
        if (!is_null($row_id_file_value)) {
            //get the incoming uploads appropiate db table row
            if (substr($row_id_file_value, -4) == '.dat' && strpos($row_id_file_value, ':') === false) {
                $path = 'uploads/incoming/' . filter_naughty($row_id_file_value);
                if (file_exists(get_custom_file_base() . '/' . $path)) {
                    $_FILES[$_attach_name] = array('type' => 'swfupload', 'name' => post_param(str_replace('hidFileID', 'hidFileName', $row_id_file)), 'tmp_name' => get_custom_file_base() . '/' . $path, 'size' => filesize(get_custom_file_base() . '/' . $path));
                    if ($i == 0) {
                        $swf_uploaded = true;
                    } else {
                        $swf_uploaded_thumb = true;
                    }
                }
            } else {
                $incoming_uploads_id = intval(preg_replace('#:.*$#', '', $row_id_file_value));
                $incoming_uploads_row = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . get_table_prefix() . 'incoming_uploads WHERE (i_submitter=' . strval(get_member()) . ' OR i_submitter=' . strval($GLOBALS['FORUM_DRIVER']->get_guest_id()) . ') AND id=' . strval($incoming_uploads_id), 1);
                //if there is a db record proceed
                if (array_key_exists(0, $incoming_uploads_row)) {
                    if (file_exists(get_custom_file_base() . '/' . $incoming_uploads_row[0]['i_save_url'])) {
                        $_FILES[$_attach_name] = array('type' => 'swfupload', 'name' => $incoming_uploads_row[0]['i_orig_filename'], 'tmp_name' => get_custom_file_base() . '/' . $incoming_uploads_row[0]['i_save_url'], 'size' => filesize(get_custom_file_base() . '/' . $incoming_uploads_row[0]['i_save_url']));
                        if ($i == 0) {
                            $swf_uploaded = true;
                        } else {
                            $swf_uploaded_thumb = true;
                        }
                    }
                }
            }
        }
    }
    if ($obfuscate == 3) {
        $accept_errors = true;
    }
    $thumb_folder = strpos($upload_folder, 'uploads/galleries') !== false ? str_replace('uploads/galleries', 'uploads/galleries_thumbs', $upload_folder) : $upload_folder . '_thumbs';
    if (!file_exists(get_custom_file_base() . '/' . $upload_folder)) {
        $success = @mkdir(get_custom_file_base() . '/' . $upload_folder, 0777);
        if ($success === false) {
            warn_exit(@strval($php_errormsg));
        }
        fix_permissions(get_custom_file_base() . '/' . $upload_folder, 0777);
        sync_file($upload_folder);
    }
    if (!file_exists(get_custom_file_base() . '/' . $thumb_folder) && $make_thumbnail) {
        $success = @mkdir(get_custom_file_base() . '/' . $thumb_folder, 0777);
        if ($success === false) {
            warn_exit(@strval($php_errormsg));
        }
        fix_permissions(get_custom_file_base() . '/' . $thumb_folder, 0777);
        sync_file($thumb_folder);
    }
    // Find URL
    require_code('images');
    if ($enforce_type == OCP_UPLOAD_IMAGE || $enforce_type == OCP_UPLOAD_IMAGE_OR_SWF) {
        $max_size = get_max_image_size();
    } else {
        require_code('files2');
        $max_size = get_max_file_size();
    }
    if ($attach_name != '' && array_key_exists($attach_name, $_FILES) && (is_uploaded_file($_FILES[$attach_name]['tmp_name']) || $swf_uploaded)) {
        if (!has_specific_permission(get_member(), 'exceed_filesize_limit')) {
            if ($_FILES[$attach_name]['size'] > $max_size) {
                if ($accept_errors) {
                    attach_message(do_lang_tempcode('FILE_TOO_BIG', integer_format($max_size)), 'warn');
                    return array('', '', '', '');
                } else {
//.........这里部分代码省略.........
开发者ID:erico-deh,项目名称:ocPortal,代码行数:101,代码来源:uploads.php


示例9: uploadDocument

function uploadDocument()
{
    $uploadDocumentComponent=array();

    $uploadDocumentComponent["xtype"]= "tabpanel";
    $uploadDocumentComponent["stateId"]= "upload_tabpanel";
    $uploadDocumentComponent["activeTab"]= "uploadform";
    $uploadDocumentComponent["dialogtitle"]= G::LoadTranslation('ID_UPLOAD');
    $uploadDocumentComponent["stateful"]= true;

    $uploadDocumentComponent["stateEvents"]= array("tabchange");
    $uploadDocumentComponent["getState"]= "function_getState";
    $functionsToReplace['function_getState']="function() {
        return {
            activeTab:this.items.indexOf(this.getActiveTab())
        };
    }";
    $uploadDocumentComponent["listeners"]["resize"]["fn"]="function_listeners_resize";
    $functionsToReplace['function_listeners_resize'] = "function(panel) {
        panel.items.each(function(item) { item.setHeight(500);return true });
    }";
    $uploadDocumentComponent["items"]=array();

    $itemA=array();

    $itemA["xtype"]= "swfuploadpanel";
    $itemA["title"]= "flashupload";
    $itemA["height"]= "300";
    $itemA["id"]= "swfuploader";
    $itemA["viewConfig"]["forceFit"]=true;
    $itemA["listeners"]["allUploadsComplete"]["fn"]="function_listeners_allUploadsComplete";
    $functionsToReplace['function_listeners_allUploadsComplete'] = "function(panel) {
                                    datastore.reload();
                                    panel.destroy();
                                    Ext.getCmp('dialog').destroy();
                                    statusBarMessage('upload_completed', false, true);
                                }";

    // Uploader Params
    $itemA["upload_url"]= "../appFolder/appFolderAjax.php";
    $itemA["post_params"][session_name()]=session_id();
    $itemA["post_params"]["option"]="uploadFile";
    $itemA["post_params"]["action"]="upload";
    $itemA["post_params"]["dir"]="datastore.directory";
    $itemA["post_params"]["requestType"]="xmlhttprequest";
    $itemA["post_params"]["confirm"]="true";

    $itemA["flash_url"]="/scripts/extjs3-ext/ux.swfupload/swfupload.swf";
    $itemA["file_size_limit"]=get_max_file_size();
    // Custom Params
    $itemA["single_file_select"]=false; // Set to true if you only want to select one file from the FileDialog.
    $itemA["confirm_delete"]=false; // This will prompt for removing files from queue.
    $itemA["remove_completed"]=false; // Remove file from grid after uploaded.
    //$uploadDocumentComponent["items"][]=$itemA;

    //Standard Upload
    $itemA=array();
    $itemA["xtype"]="form";
    $itemA["autoScroll"]=true;
    $itemA["autoHeight"]=true;
    $itemA["id"]="uploadform";
    $itemA["fileUpload"]=true;
    $itemA["labelWidth"]="125";
    $itemA["url"]="URL_SCRIPT";
    $itemA["title"]=G::LoadTranslation('ID_UPLOAD');
    //$itemA["tooltip"]="Max File Size <strong>". ((get_max_file_size() / 1024) / 1024)." MB</strong><br />
    //Max Post Size<strong>". ((get_max_upload_limit() / 1024) / 1024)." MB</strong><br />";
    $itemA["frame"]=true;
    $itemA["items"]=array();
    $itemB=array();

    $itemB["xtype"]="displayfield";
    $itemB["value"]="Max File Size <strong>". ((get_max_file_size() / 1024) / 1024)." MB</strong><br />
    Max Post Size<strong>". ((get_max_upload_limit() / 1024) / 1024)." MB</strong><br />";
    //$itemA["items"][]=$itemB;

    for ($i=0; $i<7; $i++) {
        $itemB=array();

        $itemB["xtype"]="fileuploadfield";
        $itemB["fieldLabel"]="File ".($i+1);
        $itemB["id"]="uploadedFile[$i]";
        $itemB["name"]="uploadedFile[$i]";
        $itemB["width"]=275;
        $itemB["buttonOnly"]= false;
        $itemA["items"][]=$itemB;
    }

    $itemB=array();

    $itemB["xtype"]="checkbox";
    $itemB["fieldLabel"]="Overwrite";//G::LoadTranslation('ID_OVERWRITE');
    $itemB["name"]="overwrite_files";
    $itemB["checked"]=true;
    $itemA["items"][]=$itemB;

    $itemA["buttons"]=array();

    $buttonA=array();
    $buttonA["text"]=G::LoadTranslation('ID_SAVE');
//.........这里部分代码省略.........
开发者ID:rrsc,项目名称:processmaker,代码行数:101,代码来源:appFolderAjax.php


示例10: _do_tags_comcode


//.........这里部分代码省略.........
                    }
                } elseif (substr($id, 0, 4) == 'url_') {
                    if (!has_specific_permission($source_member, 'draw_to_server') && !$as_admin) {
                        break;
                    }
                    $_id = '!';
                    $attributes['type'] = post_param('attachmenttype' . $_id, array_key_exists('type', $attributes) ? $attributes['type'] : 'auto');
                    $url = remove_url_mistakes(substr($id, 4));
                    $_POST['_specify_url'] = $url;
                    // Little hack, as we need to read it from a POST
                    if (get_magic_quotes_gpc()) {
                        $_POST['_specify_url'] = addslashes($_POST['_specify_url']);
                    }
                    $urls = get_url('_specify_url', '', 'uploads/filedump', 1, OCP_UPLOAD_ANYTHING, (!array_key_exists('thumb', $attributes) || $attributes['thumb'] != '0') && $thumb_url == '', '', '', true, true);
                    if ($urls[0] == '') {
                        return new ocp_tempcode();
                    }
                    $original_filename = rawurldecode(substr($url, strrpos($url, '/') + 1));
                    if (url_is_local($urls[0])) {
                        $_size = @filesize(get_custom_file_base() . '/' . rawurldecode($urls[0]));
                        if ($_size === false) {
                            $_size = filesize(get_file_base() . '/' . rawurldecode($urls[0]));
                        }
                    } else {
                        $_size = 0;
                    }
                } else {
                    $temp_tpl = do_template('WARNING_TABLE', array('WARNING' => do_lang_tempcode('comcode:INVALID_ATTACHMENT')));
                    break;
                }
                if ($urls[0] == '') {
                    require_code('images');
                    require_code('files2');
                    $temp_tpl = do_template('WARNING_TABLE', array('WARNING' => do_lang_tempcode('ATTACHMENT_WOULD_NOT_UPLOAD', float_format(get_max_file_size() / 1024 / 1024), float_format(get_max_image_size() / 1024 / 1024))));
                    break;
                }
                $url = $urls[0];
                if ($connection->connection_write != $GLOBALS['SITE_DB']->connection_write) {
                    $url = get_custom_base_url() . '/' . $url;
                }
                if ($thumb_url == '') {
                    $thumb_url = array_key_exists(1, $urls) ? $urls[1] : '';
                }
                if ($thumb_url != '' && $connection != $GLOBALS['SITE_DB']) {
                    $thumb_url = get_custom_base_url() . '/' . $thumb_url;
                }
                $num_downloads = 0;
                $last_downloaded_time = NULL;
                $add_time = time();
                $member_id = $on_behalf_of_member;
                if (addon_installed('galleries')) {
                    require_code('images');
                    if (is_video($url) && $connection->connection_read == $GLOBALS['SITE_DB']->connection_read) {
                        require_code('transcoding');
                        $url = transcode_video($url, 'attachments', 'a_url', 'a_original_filename', NULL, NULL);
                    }
                }
                $attachment = array('a_member_id' => $member_id, 'a_file_size' => $_size, 'a_url' => $url, 'a_thumb_url' => $thumb_url, 'a_original_filename' => $original_filename, 'a_num_downloads' => $num_downloads, 'a_last_downloaded_time' => $last_downloaded_time, 'a_add_time' => $add_time);
                $attachment['a_description'] = post_param('caption' . $_id, array_key_exists('description', $attributes) ? is_object($attributes['description']) ? '[html]' . $attributes['description']->evaluate() . '[/html]' : $attributes['description'] : '');
                $attach_id = $connection->query_insert('attachments', $attachment, true);
                $attachment['id'] = $attach_id;
                if ($tag == 'attachment2' || $tag == 'attachment_safe' || substr($id, 0, 4) == 'url_') {
                    $connection->query_delete('attachment_refs', array('r_referer_type' => 'null', 'r_referer_id' => '', 'a_id' => $attachment['id']), '', 1);
                    $connection->query_insert('attachment_refs', array('r_referer_type' => 'null', 'r_referer_id' => '', 'a_id' => $attachment['id']));
                }
                // Create and document attachment
开发者ID:erico-deh,项目名称:ocPortal,代码行数:67,代码来源:comcode_renderer.php


示例11: _gimp

 /**
  * The UI to import into a gallery.
  *
  * @return tempcode		The UI
  */
 function _gimp()
 {
     $cat = get_param('name', 'root');
     check_specific_permission('mass_import');
     if (substr($cat, 0, 7) != 'member_') {
         $test = $GLOBALS['SITE_DB']->query_value_null_ok('galleries', 'name', array('name' => $cat));
         if (is_null($test)) {
             warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
         }
     }
     $title = get_page_title('GALLERY_IMPORT');
     require_code('form_templates');
     require_lang('trackbacks');
     // To choose to batch import from an attached tar or zip file (zip file only supported if zip module running on php install)
     $post_url = build_url(array('page' => '_SELF', 'type' => '__gimp', 'cat' => $cat, 'uploading' => 1, 'redirect' => get_param('redirect', NULL)), '_SELF');
     $fields = new ocp_tempcode();
     $supported = 'tar';
     if (function_exists('zip_open') || get_option('unzip_cmd') != '') {
         $supported .= ', zip';
     }
     $fields->attach(form_input_upload_multi(do_lang_tempcode('UPLOAD'), do_lang_tempcode('DESCRIPTION_ARCHIVE_MEDIA', escape_html($supported), escape_html(str_replace(',', ', ', get_option('valid_images') . ',' . get_allowed_video_file_types()))), 'file', true, NULL, NULL, true, str_replace(' ', '', get_option('valid_images') . ',' . $supported)));
     $hidden = new ocp_tempcode();
     handle_max_file_size($hidden);
     if (get_option('is_on_gd') == '1') {
         if ($this->has_at_least_one_watermark($cat)) {
             $fields->attach(form_input_tick(do_lang_tempcode('WATERMARK'), do_lang_tempcode('DESCRIPTION_WATERMARK'), 'watermark', true));
         }
     }
     // Feedback
     require_code('feedback2');
     $fields->attach(feedback_fields(true, true, true, false, ''));
     // Max upload limit
     require_code('files2');
     $max = floatval(get_max_file_size()) / floatval(1024 * 1024);
     if ($max < 30.0) {
         $config_url = get_upload_limit_config_url();
         $text = paragraph(do_lang_tempcode(is_null($config_url) ? 'MAXIMUM_UPLOAD' : 'MAXIMUM_UPLOAD_STAFF', escape_html($max > 10.0 ? integer_format(intval($max)) : float_format($max)), escape_html(is_null($config_url) ? '' : $config_url)));
     } else {
         $text = new ocp_tempcode();
     }
     // Show form
     $hidden->attach(form_input_hidden('test', '1'));
     $form = do_template('FORM', array('_GUID' => '05de2bc134ed0b1ab703ac8bfbfabce4', 'TABINDEX' => strval(get_form_field_tabindex()), 'FIELDS' => $fields, 'SUBMIT_NAME' => do_lang_tempcode('BATCH_IMPORT_ARCHIVE_CONTENTS'), 'URL' => $post_url, 'TEXT' => $text, 'HIDDEN' => $hidden));
     // Orphaned upload form
     // To choose to batch import what already exists in gallery directory, but is orphaned
     $orphaned_content = new ocp_tempcode();
     if ($GLOBALS['FORUM_DRIVER']->is_staff(get_member()) && $GLOBALS['SITE_DB']->query_value('images', 'COUNT(*)') + $GLOBALS['SITE_DB']->query_value('videos', 'COUNT(*)') < 4000) {
         require_code('images');
         $there = array();
         $_dir = opendir(get_custom_file_base() . '/uploads/galleries/');
         while (false !== ($file = readdir($_dir))) {
             if ($file != 'index.html' && !is_dir(get_custom_file_base() . '/uploads/galleries/' . $file) && (is_image($file) || is_video($file))) {
                 $there[$file] = filemtime(get_custom_file_base() . '/uploads/galleries/' . $file);
             }
         }
         closedir($_dir);
         $_dir = @opendir(get_custom_file_base() . '/uploads/galleries/' . filter_naughty($cat));
         if ($_dir !== false) {
             while (false !== ($file = readdir($_dir))) {
                 if ($file != 'index.html' && !is_dir(get_custom_file_base() . '/uploads/galleries/' . $cat . '/' . $file) && (is_image($file) || is_video($file))) {
                     $there[$cat . '/' . $file] = filemtime(get_custom_file_base() . '/uploads/galleries/' . $cat . '/' . $file);
                 }
             }
             closedir($_dir);
         }
         if (count($there) != 0) {
             asort($there);
             $test1 = collapse_1d_complexity('url', $GLOBALS['SITE_DB']->query_select('images', array('url')));
             $test2 = collapse_1d_complexity('url', $GLOBALS['SITE_DB']->query_select('videos', array('url')));
             arsort($there);
             $temp_keys = array_keys($there);
             $last_time = $there[$temp_keys[0]];
             foreach ($there as $file => $time) {
                 if (!in_array('uploads/galleries/' . str_replace('%2F', '/', rawurlencode($file)), $test1) && !in_array('uploads/galleries/' . str_replace('%2F', '/', rawurlencode($file)), $test2)) {
                     $orphaned_content->attach(form_input_list_entry($file, $time >= $last_time - 60 * 60 * 3 || strpos($file, '/') !== false, $file));
                 }
             }
         }
         $add_url = build_url(array('page' => '_SELF', 'type' => 'ss'), '_SELF');
         if (!$orphaned_content->is_empty()) {
             $fields_2 = new ocp_tempcode();
             $hidden_2 = new ocp_tempcode();
             if (get_param_integer('keep_de_orphan', 0) == 1) {
                 $cats = nice_get_gallery_tree($cat, NULL, false, false, false, false, NULL, true);
                 $fields_2->attach(form_input_list(do_lang_tempcode('GALLERY'), '', 'cat', $cats));
             } else {
                 $hidden_2->attach(form_input_hidden('cat', $cat));
             }
             $fields_2->attach(form_input_multi_list(do_lang_tempcode('ENTRIES'), '', 'files', $orphaned_content));
             if ($this->has_at_least_one_watermark($cat)) {
                 $fields_2->attach(form_input_various_ticks(array(array(do_lang_tempcode('WATERMARK'), 'watermark', true, ''), array(do_lang_tempcode('ALLOW_RATING'), 'allow_rating', true, ''), array(do_lang_tempcode('ALLOW_COMMENTS'), 'allow_comments', true, ''), array(do_lang_tempcode('ALLOW_REVIEWS'), 'allow_reviews', false, ''), array(do_lang_tempcode('ALLOW_TRACKBACKS'), 'allow_trackbacks', true, '')), '', NULL, do_lang_tempcode('OPTIONS')));
             }
             $radios = new ocp_tempcode();
             $radios->attach(form_input_radio_entry('type', 'sa', true, do_lang_tempcode('ADD_GALLERY_SELECTION')));
             $radios->attach(form_input_radio_entry('type', 'sd', false, do_lang_tempcode('DELETE_GALLERY_SELECTION')));
//.........这里部分代码省略.........
开发者ID:erico-deh,项目名称:ocPortal,代码行数:101,代码来源:cms_galleries.php


示例12: upload_items

function upload_items($dir)
{
    if (!permissions_grant($dir, NULL, "create")) {
        show_error($GLOBALS["error_msg"]["accessfunc"]);
    }
    // Execute
    if (isset($GLOBALS['__POST']["confirm"]) && $GLOBALS['__POST']["confirm"] == "true") {
        $cnt = count($GLOBALS['__FILES']['userfile']['name']);
        $err = false;
        $err_avaliable = isset($GLOBALS['__FILES']['userfile']['error']);
        // upload files & check for errors
        for ($i = 0; $i < $cnt; $i++) {
            $errors[$i] = NULL;
            $tmp = $GLOBALS['__FILES']['userfile']['tmp_name'][$i];
            $items[$i] = stripslashes($GLOBALS['__FILES']['userfile']['name'][$i]);
            if ($err_avaliable) {
                $up_err = $GLOBALS['__FILES']['userfile']['error'][$i];
            } else {
                $up_err = file_exists($tmp) ? 0 : 4;
            }
            $abs = get_abs_item($dir, $items[$i]);
            if ($items[$i] == "" || $up_err == 4) {
                continue;
            }
            if ($up_err == 1 || $up_err == 2) {
                $errors[$i] = $GLOBALS["error_msg"]["miscfilesize"];
                $err = true;
                continue;
            }
            if ($up_err == 3) {
                $errors[$i] = $GLOBALS["error_msg"]["miscfilepart"];
                $err = true;
                continue;
            }
            if (!is_uploaded_file($tmp)) {
                $errors[$i] = $GLOBALS["error_msg"]["uploadfile"];
                $err = true;
                continue;
            }
            if (file_exists($abs) && empty($_REQUEST['overwrite_files'])) {
                $errors[$i] = $GLOBALS["error_msg"]["itemdoesexist"];
                $err = true;
                continue;
            }
     

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_max_upload_file_size函数代码示例发布时间:2022-05-15
下一篇:
PHP get_max函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap