Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    upload con password. Mi testate questo script?

    Cari amici, ho reperito uno script con possibilità di password molto pratico e funzionale.
    Potete vedere la pagina di test a questo indirizzo:
    www.emiliorescigno.it/php/index.php

    il problema è che seppur correttamente installato l'esempio, come da indicazioni, non riesco
    proprio a farlo funzionare.
    Ho dato il CHMOD sia nelle singole cartelle che in quella che le contiene tutte. La stessa cosa ho fatto per i due files php contenuti dentro la cartella PHP che ho creato. (e forse è proprio qui che sta l'inghippo ma se mettevo il file php assieme all'index.html prevaleva il php su quest'ultimo e non si accedeva piu' al sito.
    Penso sia un problema di path.

    questo è il messaggio che si ottiene quando si tenta di uploadare una immagine:

    Warning: Unable to create 'uploads/docs/epo8.jpg': No such file or directory in /home/freenet/a200/www.emiliorescigno.it/htdocs/php/index.php on line 87

    Warning: Unable to move '/tmp/phpfcomko' to 'uploads/docs/epo8.jpg' in /home/freenet/a200/www.emiliorescigno.it/htdocs/php/index.php on line 87

    grazie.


    Vi allego il testo degli script:

    1) index.php
    [PHP]
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en">
    <head>
    <title>ES Simple Uploader</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <meta name="generator" content="handmade" />
    <style type="text/css">
    <!--
    body {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    background-color: #DDDDDD;
    }
    .cnt {
    text-align: center;
    }
    .cnt_welcome {
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    }
    .cnt_powered {
    font-size: 14px;
    font-weight: bold;
    text-align: center;
    }
    .cnt_small {
    font-size: 12px;
    text-align: center;
    padding-top: 50px;
    }
    .head_line {
    background-color: #BBBBBB;
    }
    .main_table {
    border: solid 1px #9D9992;
    font-size: 13px;
    }
    h4 {
    font-size: 12px;
    color: #DD0000;
    text-align: center;
    }
    .button {
    border: 1px solid #55555;
    font-weight: bold;
    }
    -->
    </style>
    </head>

    <body>
    <?
    include("config.php");

    function path_options()
    {
    global $upload_dirs;
    $option = "";
    foreach ($upload_dirs as $path => $pinfo)
    {
    $option .= '<option value="'.$path.'">'.$pinfo["name"].'</option>';
    }
    return $option;
    }

    function check_vals()
    {
    global $upload_dirs, $err;
    if (!ini_get("file_uploads")) { $err .= "HTTP file uploading is blocked in php configuration file (php.ini). Please, contact to server administrator."; return 0; }
    $pos = strpos(ini_get("disable_functions"), "move_uploaded_file");
    if ($pos !== false) { $err .= "PHP function move_uploaded_file is blocked in php configuration file (php.ini). Please, contact to server administrator."; return 0; }
    if (!isset($_POST["path"]) || (strlen($_POST["path"]) == 0)) { $err .= "Please fill out path"; return 0; }
    if (!isset($upload_dirs[$_POST["path"]])) { $err .= "Incorrect path"; return 0; }
    if (!isset($_POST["pwd"]) || (strlen($_POST["pwd"]) == 0)) { $err .= "Please fill out password"; return 0; }
    elseif ($_POST["pwd"] != $upload_dirs[$_POST["path"]]["password"]) { $err .= "The upload password is incorrect"; return 0; }
    if (!isset($_FILES["userfile"])) { $err .= "Empty file"; return 0; }
    elseif (!is_uploaded_file($_FILES['userfile']['tmp_name'])) { $err .= "Empty file"; return 0; }
    return 1;
    }

    $err = ""; $status = 0;
    if (isset($_POST["upload"])) {
    if (check_vals()) {
    if (filesize($_FILES["userfile"]["tmp_name"]) > $max_file_size) $err .= "Maximum file size limit: $max_file_size bytes";
    else {
    if (move_uploaded_file($_FILES["userfile"]["tmp_name"], $upload_dirs[$_POST["path"]]["dir"].$_FILES["userfile"]["name"])) {
    $status = 1;
    }
    else $err .= "There are some errors!";
    }
    }
    }

    if (!$status) {
    if (strlen($err) > 0) echo "<h4>$err</h4>";
    }
    else {
    echo "<h4>"".$_FILES["userfile"]["name"]."" was successfully uploaded.</h4>";
    }
    ?>
    <p class="cnt_welcome">Welcome to ES Simple Uploader v 1.0.</p>
    <p class="cnt">« Back to Product page «</p>
    <p class="cnt">(Select folder, set it's password, then select a file to upload and click "Upload" button).

    Note:
    Folder: "Images folder", Password: "images";
    Folder: "Docs", Password: "docs";
    Folder: "Common files", Password: "common";
    Maximum file size: <?=$max_file_size/1024?> Kb.</p>

    <form enctype="multipart/form-data" action="index.php" method="POST">
    <input type="hidden" name="MAX_FILE_SIZE" value="<?=$max_file_size?>" />
    <table class="main_table" align="center">
    <tr>
    <td colspan="2" class="head_line"> </td>
    </tr>
    <tr>
    <td>Folder:</td>
    <td><select name="path"><?=path_options()?></select></td>
    </tr>
    <tr>
    <td>Password:</td>
    <td><input type="password" name="pwd" style="width: 217px;" /></td>
    </tr>
    <tr>
    <td>Choose file:</td>
    <td><input type="file" name="userfile" style="width: 222px;" /></td>
    </tr>
    <tr>
    <td colspan="2" align="right"><input type="submit" name="upload" value="Upload" class="button" /></td>
    </tr>
    </table>
    </form>
    <p class="cnt_powered">Powered by EnergyScripts
    <p class="cnt_small">Find more power solution: ES File Upload & Download Manager
    </body>
    </html>

    [PHP]

    2) config.php

    [PHP]
    <?
    /*
    Upload dirs(folders) list
    - - - - - - - - - - - - - - - - - -
    "images" => array(
    "dir" =>"uploads/images",
    "password"=>"images",
    ),
    - - - - - - - - - - - - - - - - - -
    "images" - just section name (any name you like), it is a key
    "name" - the dir(folder) name in select box
    "dir" - path to uploaded files
    "password" - "dir" password
    */
    $upload_dirs = array(
    "images" => array(
    "dir" =>"uploads/images/",
    "name" =>"Images folder",
    "password"=>"images",
    ),
    "docs" => array(
    "dir" =>"uploads/docs/",
    "name" =>"Docs",
    "password"=>"docs",
    ),
    "common" => array(
    "dir" =>"uploads/common/",
    "name" =>"Common files",
    "password"=>"common",
    ),
    );

    $max_file_size = 500000*1024; //max file upload size (bytes)
    ?>

    [PHP]
    __________________
    webbeginner
    ___________________________________
    noi agiamo, sentiamo e pensiamo non in conformità all'aspetto reale delle cose ma secondo le immagini che la mente si è fatta delle cose...
    ____________________________________
    webbeginner
    ___________________________________
    noi agiamo, sentiamo e pensiamo non in conformità all'aspetto reale delle cose ma secondo le immagini che la mente si è fatta delle cose...
    ____________________________________

  2. #2

    RISOLTO

    era solo un problema di paht

    http://www.emiliorescigno.it/uploadimages/index.php

    grazie comunque
    webbeginner
    ___________________________________
    noi agiamo, sentiamo e pensiamo non in conformità all'aspetto reale delle cose ma secondo le immagini che la mente si è fatta delle cose...
    ____________________________________

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.