示例#1
0
 if ($tfile['name']) {
     $tfilen = basename($tfile['name']);
     $buffer .= "<tr><td>Uploading file '{$tfile['name']}'...</td><td>";
     if (is_uploaded_file($tfile['tmp_name'])) {
         $tfiletn = $tfilen;
         $i = 1;
         while (file_exists('cache/up/' . $tfiletn)) {
             $tfiletn = $tfilen . ' (' . ++$i . ')';
         }
         if (move_uploaded_file($tfile['tmp_name'], 'cache/up/' . $tfiletn)) {
             $buffer .= '<strong style="color:#090;">Successful</strong>';
             $buffer .= "</td></tr><tr><td>...to current directory...</td><td>";
             $tfiletn2 = $tfilen;
             $i = 1;
             //while (fm_exists($d.$tfiletn2)) $tfiletn2 = addbeforeext($tfilen,' ('.(++$i).')');
             if (fm_upload($tfiletn, $d . $tfiletn2, $conflict)) {
                 $buffer .= '<strong style="color:#090;">Successful</strong>';
                 $acted[] = file2id($tfiletn2);
             } else {
                 $buffer .= '<strong style="color:#F00;">Failed' . (fm_exists($d . $tfiletn2) ? ", '{$tfilen}' already exists" : ', permission error (Filecharger installed incorrectly?)') . '</strong>';
                 $redir = false;
             }
         } else {
             $buffer .= '<strong style="color:#F00;">Failed, Filecharger may be installed incorrectly (check permissions on temporary directory "cache/up/")</strong>';
             $redir = false;
         }
     } else {
         if ($tfile['error'] == UPLOAD_ERR_INI_SIZE) {
             $buffer .= '<strong style="color:#F00;">Failed; file larger than PHP max upload file size</strong>';
         } else {
             if ($tfile['error'] == UPLOAD_ERR_FORM_SIZE) {
function fm_compresszip($files, $dest = FALSE, $overwrite = FALSE)
{
    if (file_exists($dest) && !$overwrite || !count($files)) {
        return FALSE;
    } else {
        fm_delete($dest);
    }
    @unlink('cache/up/temp.zip');
    $lfiles = fm_mkalllocal($files);
    $archive = new PclZip('cache/up/temp.zip');
    $archive->create($lfiles, PCLZIP_OPT_REMOVE_PATH, upOne($lfiles[0]));
    fm_recachedir('down/local/');
    $res = fm_upload('temp.zip', $dest, $overwrite);
    @unlink('cache/up/temp.zip');
    return $res;
}
示例#3
0
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    <title>Upload</title>
    <style type="text/css"><!--
      @import "fileman.css";
    --></style>
  </head>
  <body style="overflow:hidden;background:#AEC8EC none;">
  <div style="padding:5px;">
<?php 
            foreach ($_FILES as $tfile) {
                if ($tfile['name']) {
                    $tfilen = basename($tfile['name']);
                    echo "Uploading '{$tfilen}'... ";
                    move_uploaded_file($tfile['tmp_name'], 'cache/up/' . $tfilen) or die(':(');
                    if (fm_upload($tfilen, $d . $tfilen)) {
                        echo '<strong style="color:#090;">Successful</strong> ';
                    } else {
                        echo '<strong style="color:#F00;">Failed</strong> ';
                    }
                }
            }
            ?>
      <input type="button" value="Done" onclick="window.location.href='index.php?p=a&d=<?php 
            echo $hd, $hasid;
            ?>
';" /> <input type="button" value="Upload more files" onclick="location.replace('fileman_ext.php?upload&amp;d=<?php 
            echo $hd, $hasid;
            ?>
');" />
    </div>