Visualizzazione dei risultati da 1 a 2 su 2

Discussione: Upload File

  1. #1
    Utente di HTML.it L'avatar di thitan
    Registrato dal
    Feb 2001
    Messaggi
    716

    Upload File

    nn riesco a fare l'upload dei file con uno script php, mi dà sempre questo errore:
    codice:
    Warning: Unable to open '' for reading: No such file or directory in /usr/local/psa/home/vhosts/consulentiassociati.com/httpdocs/Admin/Upload/upload.php on line 46
    
    Warning: unlink() failed (No such file or directory) in /usr/local/psa/home/vhosts/consulentiassociati.com/httpdocs/Admin/Upload/upload.php on line 47
    
    Warning: Cannot add header information - headers already sent by (output started at /usr/local/psa/home/vhosts/consulentiassociati.com/httpdocs/Admin/Upload/upload.php:46) in /usr/local/psa/home/vhosts/consulentiassociati.com/httpdocs/Admin/Upload/upload.php on line 50
    /usr/local/psa/home/vhosts/consulentiassociati.com/httpdocs/Admin/Upload/Upload_Bandi
    you@your-domain.co.uk
    http://www.your-domain.co.uk/thanks.htm
    il codice della pagina di upload è questo:
    codice:
    <?
    
    /* Easy Uploader */
    
    // set variables (SET THESE TO SUIT YOUR CIRCUMSTANCES):
    
    // Upload directory (MUST HAVE TRAILING SLASH):
    $uploaddir="/usr/local/psa/home/vhosts/consulentiassociati.com/httpdocs/Admin/Upload/Upload_Bandi";
    // Your email
    $youremail="you@your-domain.co.uk";
    // Thank you page:
    $thankspage="http://www.your-domain.co.uk/thanks.htm";
    
    $realname=$POST['realname'];
    $file=$_POST['file'];
    $email=$_POST['email'];
    // Set Upload thanks message for USER
    $uptymessage="$realname, thank you for uploading the file $file_name\n\nWe will get back to you ASAP.";
    // Set Upload thanks message for OWNER
    $ownermessage="$realname [ $email ] has uploaded a file named $file_name\n\nCheck the upload directory.";
    // Email message on or off ?  1 = on, 0 = off
    $emailmessages = "1";
    
    
    // start code (DO NOT CHANGE ANYTHING BELOW THIS LINE):
    
    // Check for valid email address
    
    $x = ereg("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]{2,3}$",$email);
    if($x==0)
    
    // if no valid email address entered, display no email message
    {
    echo "<div align=center>You must specify a valid email address for yourself. <a href=javascript:history.back(-1)>Return to the form</a>.</div>";
    }
    else {
    
    // Check to see if valid file
    if ($file == "none") {
    // if no valid email address entered, display no file message
    echo "<div align=center>You must specify a file to upload. <a href=javascript:history.back(-1)>Return to the form</a>.</div>";
    } 
    else { 
    //directory to upload to
    copy($file, $uploaddir.$file_name);
    unlink($file);
    
    //return thank you page
    Header("Location: $thankspage");
    }
    }
    
    
    
    
    if ($emailmessages == "1") {
    //mail you to let you know a new uploaded file
    mail("$youremail", "Uploaded file", "$ownermessage");
    //mail user to thank them
    mail("$email", "Uploaded file", "$uptymessage");
    exit;
    }
    
    ?>
    mentre il codice della pagina con il form è:
    codice:
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    
    <body bgcolor="#FFFFFF">
    <form action="upload.php" method="post" ENCTYPE="multipart/form-data"> 
       File to upload:<input type="file" size=40 name="file">
     
       <input type="hidden" name="MAX_FILE_SIZE" value="100000">
    Your Name<input type="text" name="realname">
    
    Your Email<input type="text" name="email">
     
       <input type="submit" value="upload"> 
       </form> 
    </body>
    </html>
    la pagina con il form di upload è http://www.consulentiassociati.com/A...load/form.htm,
    la cartella è http://www.consulentiassociati.com/A...d/Upload_Bandi


    p.s: lo script l'ho scaricato da freephp.it...xchè nn funzia?
    dove sbaglio?

    www.inter-rail.it
    travellers, not tourist
    Is cuma cá mhinice a théann tú ar strae; is é is tábhachtaí gurb áil leat do bhealach a aimsiú arís.

  2. #2
    cambia upload.
    prova questo
    molto semplice ma funziona
    http://freephp.html.it/zip/script/file/1_file.zip

    e, nella hp del tuo profilo, inserisci un solo link...

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.