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

    problema download e cancella

    HO QUESTO CODICE CHE MI VISUALIZZA I FILE CONTENUTI SOTTO UNA CARTELLA SUL SERVER.....VORREI AVERE LA POSSIBILITA' DI SELEZIONARE I FILE E DI POTERLI CANCELLARE DALLA CARTELLA

    COME SI FA.......?NON SO PROPRIO DA DOVE INIZIARE



    <html>
    <head>
    <title>File Download</title>
    </head>
    <body> <a href=$websiteurl>Return to $websitename";
    $list = "<table width=700 border=1 bordercolor=#000000 style=\"border-collapse: collapse\">";
    $list .= "<tr><td width=700><center>Click To Download</center></td></tr>";
    $dir = opendir($absolute_path);
    while($file = readdir($dir)) {
    if (($file != "..") and ($file != ".")) {
    $list .= "<tr><td width=700><center><a href=$dl/$file>$file</a></center></td></tr>";
    }
    }
    $list .= "</table>";
    echo $list;
    echo"



    Powered by <a href=http://www.davidefrancese.it/>PHP Uploader Downloader</a>
    </body>
    </html>";

  2. #2
    Codice PHP:
    <?php
      $action 
    $_REQUEST['action'];
      if (
    $action) {
        if (
    $action=='upload') {
          
    // upload file
        
    }
        if (
    $action=='download') {
          
    // download file
        
    }
        if (
    $upload=='cancella') {
          
    // cancella file
        
    }
      }
    ?>
    <html>
    <head>
    <title>File Download</title>
    </head>
    <body>
    [url="<?=$PHP_SELF?>?action=upload"]Upload File[/url] [url="<?=$websiteurl?>"]Return to <?=$websitename?>[/url]";
    <form id="options" method="post" action="<?=PHP_SELF?>">
    <?php
    $list 
    "<table width=700 border=1 bordercolor=#000000 style=\"border-collapse: collapse\">";
    $list .= "<tr><td width=700><center>[b]Click To Download[/b]</center></td></tr>";
    $dir opendir($absolute_path);
    while(
    $file readdir($dir)) {
      if ((
    $file != "..") and ($file != ".")) {
        
    $list .= "<tr><td width=700><center>$file</a></center></td>";
        
    $list .= "<td><input type=\"button\" value=\"download\" onclick=\"document.forms[0].action='<?=$PHP_SELF?>?action=download; document.forms[0].submit()\" />";
        
    $list .= "input type=\"button\" value=\"cancella\" onclick=\"document.forms[0].action='<?=$PHP_SELF?>?action=cancella; document.forms[0].submit()\" /></td></tr>";
      }
    }
    $list .= "</table>";
    echo 
    $list;
    </
    form>
    echo
    "



    Powered by <a href=http://www.davidefrancese.it/>PHP Uploader Downloader</a>"
    ;
    ?>
    </body>
    </html>";
    come vedi assieme al nome di file ho aggiunto due pulsanti DOWNLAOD e CANCELLA; quando ci clicchi la pagina viene ricaricata ed eseguito l'ordine scelto.

  3. #3

    grazie

    proverò in serata e ti farò sapere

  4. #4

    ho provato ma

    mi fa visualizzare solo semplicemente i tasti
    di download e cancella

    ma non fa l'azione cioè non scarica e ne cancella
    ti riposto il codice
    intero

    <?
    $sizelimit = "no"; //Do you want a size limit, yes or no?
    $sizebytes = "200000"; //size limit in bytes
    $dl = "http://www.davidefrancese.it/httpdocs/new/images/"; //url where files are uploaded
    $absolute_path = "/usr/local/psa/home/vhosts/davidefrancese.it/httpdocs/new/images/"; //Absolute path to where files are uploaded
    $websiteurl = "http://www.davidefrancese.it"; //Url to you website
    $websitename = "Davide Francese";

    switch($action) {
    default:
    echo"
    <html>
    <head>
    <title>Upload Or Download</title>
    </head>
    <body>
    <a href=$PHP_SELF?action=upload>Upload File</a>
    <a href=$PHP_SELF?action=download>Download File</a>
    <a href=$websiteurl>Return to $websitename</a>



    Powered by <a href=http://www.davidefrancese.it/>PHP Uploader Downloader</a>
    </body>
    </html>";
    break;

    case "download":
    $action = $_REQUEST['action'];
    if ($action) {
    if ($action=='upload') {
    // upload file
    }
    if ($action=='download') {
    // download file
    }
    if ($upload=='cancella') {
    // cancella file
    }
    }
    echo "
    <html>
    <head>
    <title>File Download</title>
    </head>
    <body> <a href=$websiteurl>Return to $websitename
    <form id='options' method='post' action='<?=PHP_SELF?>'> ";
    $list = "<table width=700 border=1 bordercolor=#000000 style=\"border-collapse: collapse\">";
    $list .= "<tr><td width=700><center>Click To Download</center></td></tr>";
    $dir = opendir($absolute_path);
    while($file = readdir($dir)) {
    if (($file != "..") and ($file != ".")) {
    $list .= "<tr><td width=700><center>$file</a></center></td>";
    $list .= "<td><input type=\"button\" value=\"download\" onclick=\"document.forms[0].action='<?=$PHP_SELF?>?action=download; document.forms[0].submit()\" />";
    $list .= "<input type=\"button\" value=\"cancella\" onclick=\"document.forms[0].action='<?=$PHP_SELF?>?action=cancella; document.forms[0].submit()\" /></td></tr>";
    }
    }
    $list .= "</table></form>";

    echo $list;

    echo"



    Powered by <a href=http://www.davidefrancese.it/>PHP Uploader Downloader</a>
    </body>
    </html>";
    break;

    case "upload":
    echo"
    <html>

    <head>
    <title>File Upload</title>
    </head>

    <body>

    <form method=POST action=$PHP_SELF?action=doupload enctype=multipart/form-data>


    File to upload:

    <input type=file name=file size=30>


    <button name=submit type=submit>
    Upload
    </button>
    </form>



    Powered by <a href=http://www.davidefrancese.it/>PHP Uploader Downloader</a>
    </body>

    </html>";
    break;


    //File Upload
    case "doupload":
    $dir = "dir";
    if ($file != "") {

    if (file_exists("$absolute_path/$file_name")) {
    die("File already exists");
    }

    if (($sizelimit == "yes") && ($file_size > $sizebytes)) {
    die("File is to big. It must be $sizebytes bytes or less.");
    }


    @copy($file, "$absolute_path/$file_name") or die("The file you are trying to upload couldn't be copied to the server");

    } else {
    die("Must select file to upload");
    }
    echo "
    <html>
    <head>
    <title>File Uploaded</title>
    </head>
    <body>";
    echo $file_name." was uploaded";
    echo "

    <a href=$PHP_SELF?action=upload>Upload Another File</a>
    <a href=$PHP_SELF?action=download> Download File</a>
    <a href=$websiteurl> Return to $websitename</a>


    Powered by <a href=http://www.davidefrancese.it/>PHP Uploader Downloader</a>
    </body>
    </html>";
    break;

    }
    ?>

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 © 2025 vBulletin Solutions, Inc. All rights reserved.