Exemplo n.º 1
0
                        // this php file is prototype ajax request with evalscript
                        // enabled.
                    }
                }
                jQuery('#directory-label').parent().parent().fadeOut();
            }
            else if (selectedValue == "upload") {
                jQuery('#package-temp-directory').load('<?php 
echo urlStrRedirect("pkgs/pkgs/ajaxDisplayUploadForm");
?>
&papi=' + selectedPapi);
                // reset form fields
                jQuery('#version').val("");
                jQuery('#commandcmd').val("");
                jQuery('#directory-label').html("<?php 
echo sprintf(_T("Files upload (<b><u title='%s'>%sM max</u></b>)", "pkgs"), _T("Change post_max_size and upload_max_filesize directives in php.ini file to increase upload size.", "pkgs"), get_php_max_upload_size());
?>
");
                jQuery('#directory-label').parent().parent().fadeIn();
            }

        });
    });
<?php 
// if one package API, hide field
if (count($list) < 2) {
    echo <<<EOT
            // Hide package api field
            jQuery('#p_api').parents('tr:first').hide();
EOT;
}
Exemplo n.º 2
0
<?php

/****************************************
Example of how to use this uploader class...
You can uncomment the following lines (minus the require) to use these as your defaults.
/******************************************/
session_start();
// Current path is [mmc_web_dir]/modules/pkgs/lib/fileuploader/
require_once "../../../../includes/xmlrpc.inc.php";
// For isXMLRPCError() function
require_once "../../../../modules/pkgs/includes/xmlrpc.php";
require_once "../../../../modules/pkgs/includes/functions.php";
// list of valid extensions, ex. array("jpeg", "xml", "bmp")
$allowedExtensions = array();
// max file size in bytes
$sizeLimit = get_php_max_upload_size() * 1024 * 1024;
//require('valums-file-uploader/server/php.php');
$uploader = new qqFileUploader($allowedExtensions, $sizeLimit);
// Call handleUpload() with the name of the folder, relative to PHP's getcwd()
// Put uploaded file in PHP upload_tmp_dir / random_dir
// FIXME: With IE, can't use $_GET values ?? So I use $_SESSION values
$random_dir = isset($_GET['random_dir']) ? $_GET['random_dir'] : $_SESSION['random_dir'];
$p_api_id = isset($_GET['selectedPapi']) ? $_GET['selectedPapi'] : $_SESSION['p_api_id'];
$upload_tmp_dir = sys_get_temp_dir();
mkdir($upload_tmp_dir . '/' . $random_dir);
$result = $uploader->handleUpload($upload_tmp_dir, $random_dir, $p_api_id);
// to pass data through iframe you will need to encode all html tags
echo htmlspecialchars(json_encode($result), ENT_NOQUOTES);
/**
 * Handle file uploads via XMLHttpRequest
 */
Exemplo n.º 3
0
$p->setSideMenu($sidemenu);
$p->display();
if ($_GET['action'] == 'add' and strlen($_POST['random_dir'] == 0)) {
    if (isset($_POST['random_dir']) and strlen($_POST['random_dir']) == 0) {
        new NotifyWidgetFailure(_T('No files uploaded'), "pkgs");
    }
    // first page when we add a package
    // display an upload form
    $f = new ValidatingForm(array('enctype' => "multipart/form-data"));
    $f->push(new Table());
    if ($multipapi) {
        $f->add(new TrFormElement(_T("Package API", "pkgs"), $selectpapi), array("value" => $p_api_id, "required" => True));
    } else {
        $f->add($selectpapi, array("value" => $p_api_id, "required" => True, "hide" => True));
    }
    $f->add(new TrFormElement(sprintf(_T("Select files you want to import (%sM max)", "pkgs"), get_php_max_upload_size()), new MultiFileTpl('filepackage'), array("required" => True, "tooltip" => _T("Change <strong>post_max_size</strong> and <strong>upload_max_filesize</strong> directives in php.ini file to increase upload size.", "pkgs"))));
    $f->add(new HiddenTpl("id"), array("value" => $package['id'], "hide" => True));
    if ($_GET["action"] == "add") {
        $f->add(new HiddenTpl("mode"), array("value" => "creation", "hide" => True));
    }
    $f->pop();
    $f->addValidateButton("bimport", _T("Add", "pkgs"));
} else {
    // second page: display an edit package form (description, version, ...)
    // this form is also displayed when a package is edited
    $f = new ValidatingForm();
    $f->push(new Table());
    $p_api_id = $_GET['p_api'] ? base64_decode($_GET['p_api']) : base64_decode($_POST['p_api']);
    $selectpapi = new HiddenTpl('p_api');
    if ($multipapi or $p_api_number > 1) {
        $f->add(new TrFormElement(_T("Package API", "pkgs"), $selectpapi), array("value" => $p_api_id, "hide" => $hide));