示例#1
0
    if ($_INI['debug_ajax']) {
        showDebugMessage("Failed to find flength file {$flength_file}");
    }
    showAlertMessage("<span class='ubrError'>ERROR</span>: Failed to find <a href='http://uber-uploader.sourceforge.net/?section=flength' target='_new'>flength file</a>", 1);
} elseif (strstr($total_upload_size, "ERROR")) {
    // Found the flength file but it contains an error
    list($error, $error_num, $error_msg) = explode($DATA_DELIMITER, $total_upload_size);
    if ($_INI['debug_ajax']) {
        showDebugMessage($error_msg);
    }
    if (!deleteDir($TEMP_DIR . $UPLOAD_ID . '.dir')) {
        if ($_INI['debug_ajax']) {
            showDebugMessage("Failed to delete " . $TEMP_DIR . $UPLOAD_ID . ".dir");
        }
    }
    stopUpload();
    if ($error_num == 1) {
        $formatted_error_msg = "<span class='ubrError'>ERROR</span>: Failed to open link file " . $UPLOAD_ID . ".link";
    } elseif ($error_num == 2 || $error_num == 3) {
        $formatted_error_msg = "<span class='ubrError'>ERROR</span>: " . $error_msg;
    }
    showAlertMessage($formatted_error_msg, 1);
} else {
    // Keep trying to read the hook file until timeout
    if ($_INI['cgi_upload_hook']) {
        for ($i = 0; $i < $_INI['hook_timeout_limit']; $i++) {
            if ($hook_data = readUbrFile($hook_file, $_INI['debug_ajax'])) {
                $found_hook_file = true;
                break;
            }
            clearstatcache();
示例#2
0
    $file = format_filename($file);
    //cheking file name
    if (ereg("[^a-zA-Z0-9._-]", $file)) {
        die(stopUpload('alert', $DLG['invalid_filename']));
    }
    //check is file name exists
    if (file_exists($directory . $file)) {
        die(stopUpload('alert', $DLG['file_exists']));
    }
    umask(02);
    //uploadig file
    if (!copy($_FILES['file']['tmp_name'], $directory . $file)) {
        die(stopUpload('error', $DLG['upload_failure']));
    }
    $msg = rawurlencode("<b>'{$file}'</b> {$DLG['upload_success']}<br><a href=\"javascript:browser.insertFile('{$file}');\">{$DLG['insert_uploaded']}</a>");
    die(stopUpload('done', $msg));
}
?>
<form id="upload_form" action="scripts/upload_file.php" method="post" enctype="multipart/form-data" target="upload_target" onsubmit="browser.upload.start(this);" >
	<input type="hidden" name="MAX_FILE_SIZE" value="10000000" />
	<p class="info" ><?php 
echo $DLG['select_to_upload'];
?>
</p>
	<table>
		<tr><td colspan="2"></td></tr>
		<tr><td><?php 
echo $DLG['dir'];
?>
: </td><td><input type="input" name="dir" value="<?php 
echo $dir;