Visualizzazione risultati 1 fino 6 di 6

Discussione: [PHP] Errore In script upload

  1. #1
    Guest

    Predefinito [PHP] Errore In script upload

    questo script mi da sempre un errore
    questo di questa righa ma io ho provato a cambiare la variabile ma non funziona mi rida sempre quel errore
    righa:
    @copy($file, "$absolute_path/$file_name") or die("The file you are trying to upload couldn't be copied to the server");
    errore:
    Codice PHP:
    The file you are trying to upload couldn't be copied to the serve
    script.php
    Codice PHP:
    <?
    $extlimit
    = "yes"; //Do you want to limit the extensions of files uploaded
    $limitedext = array(".gif",".jpg",".png",".jpeg"); //Extensions you want files uploaded limited to.
    $sizelimit = "no"; //Do you want a size limit, yes or no?
    $sizebytes = "200000"; //size limit in bytes
    $dl = "http://sk1zzo.altervista.org/upload/"; //url where files are uploaded
    $absolute_path = "http://sk1zzo.altervista.org/upload"; //Absolute path to where files are uploaded
    $websiteurl = "http://sk1zzo.altervista.org/index.html"; //Url to you website
    $websitename = "5k1zz0 Home";

    if (!isset(
    $action)) {
    $action = "";
    }

    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>
    <br><br>
    Powered by <a href=http://sk1zzo.altervista.org/>5k1zz0 Blog</a>
    </body>
    </html>"
    ;
    break;
    case
    "download":
    echo
    "
    <html>
    <head>
    <title>File Download</title>
    </head>
    <body><a href=
    $PHP_SELF?action=upload>Upload File</a> <a href=$websiteurl>Return to $websitename</a>";
    $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 != ".")) {
    //Download files with spaces fix by Kokesh
    $list .= "<tr><td width=700><a href='$dl/$file'>$file</a></center></td></tr>";
    }
    }
    $list .= "</table>";
    echo
    $list;
    echo
    "
    <br><br>
    Powered by <a href=http://www.zachwhite.com/>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>
    <p>File to upload:<br>
    <input type=file name=file size=30>
    <p><button name=submit type=submit>
    Upload
    </button>
    </form>
    <br><br>
    Powered by <a href=http://www.zachwhite.com/>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.");
    }

    $ext = strrchr($file_name,'.');
    if ((
    $extlimit == "yes") && (!in_array($ext,$limitedext))) {
    die(
    "The file you are uploading doesn't have the correct extension.");
    }

    @
    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
    "<br>
    <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><br><br>
    Powered by <a href=http://www.zachwhite.com/>PHP Uploader Downloader</a>
    </body>
    </html>"
    ;
    break;

    }
    ?>

  2. #2
    Guest

    Predefinito

    L'errore è in queste 3 righe:
    Codice PHP:
    $dl = "http://sk1zzo.altervista.org/upload/"; //url where files are uploaded
    $absolute_path = "http://sk1zzo.altervista.org/upload"; //Absolute path to where files are uploaded
    $websiteurl = "http://sk1zzo.altervista.org/index.html"; //Url to you website
    Non puoi utilizzare gli url completi (http:// sito . com) ma soltanto gli url relativi (/cartella/)

  3. #3
    Guest

    Predefinito

    Codice PHP:
    $dl = "/upload/"; //url where files are uploaded
    $absolute_path = "/upload"; //Absolute path to where files are uploaded
    $websiteurl = "/index.html"; //Url to you website
    ho provato cosi ma non funziona lo stesso

  4. #4
    Guest

    Predefinito

    Lo script non mi sembra fatto bene, per essere uno script di upload che non usa l'array $_FILES e le funzioni is_uploaded_file / move_uploaded_file non capisco come possa fare per inviare il file...

  5. #5
    Guest

    Predefinito

    Codice PHP:
    $dl = "/upload/"; //url where files are uploaded
    $absolute_path = getcwd()."/upload/"; //Absolute path to where files are uploaded
    $websiteurl = "http://www.sk1zzo.altervista.org"; //Url to you website
    Ciao.

  6. #6
    Guest

    Predefinito

    Citazione Originalmente inviato da sIM Visualizza messaggio
    Codice PHP:
    $dl = "/upload/"; //url where files are uploaded
    $absolute_path = getcwd()."/upload/"; //Absolute path to where files are uploaded
    $websiteurl = "http://www.sk1zzo.altervista.org"; //Url to you website
    Ciao.
    Grazie funziona

Regole di scrittura

  • Non puoi creare nuove discussioni
  • Non puoi rispondere ai messaggi
  • Non puoi inserire allegati.
  • Non puoi modificare i tuoi messaggi
  •