Pagina 1 di 3 1 2 3 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 22

Discussione: Aggiungere opzione

  1. #1

    Aggiungere opzione

    Salve a tutti, nel mio hosting vorrei aggiunere l'anteprima dell'immagine hostata e sotto all'anteprima i dati dell'immagine.

    il codice php è:
    Codice PHP:
                                                                          #-----------------------------------------------------------#
                                       # this function will upload the files.  :) ;) cool          #
                                       #-----------------------------------------------------------#
                                       
    if (move_uploaded_file($file_tmp,$upload_dir.$file_name)) {
                                       
    #-----------------------------------------------------------#
                                       # this function will upload the files.  :) ;) cool          #
                                       #-----------------------------------------------------------#
                                       
    if (move_uploaded_file($file_tmp,$upload_dir.$file_name)) {
                                           echo 
    "File $i: [url='http://webhost.webarrivo.com/upload/$file_name']$file_name[/url] è stato uppato correttamente.
    "
    ;
                                       }else{
                                            echo 
    "File $i: upload fallito.
    "
    ;
                                       }
    #end of (move_uploaded_file).

                                 
    }#end of (file_exists).

                           
    }#end of (file_size).

                     
    }#end of (limitedext).

               
    }#end of (!is_uploaded_file).

           
    }#end of (for loop).
           # print back button.
           
    echo "»<a href=\"$_SERVER[PHP_SELF]\">back</a>";
                                       }else{
                                            echo 
    "File $i: upload fallito.
    "
    ;
                                       }
    #end of (move_uploaded_file).

                                 
    }#end of (file_exists).

                           
    }#end of (file_size).

                     
    }#end of (limitedext).

               
    }#end of (!is_uploaded_file).

           
    }#end of (for loop).
           # print back button.
           
    echo "»<a href=\"$_SERVER[PHP_SELF]\">back</a>"
    io devo modificare la riga
    Codice PHP:
                                                             if (move_uploaded_file($file_tmp,$upload_dir.$file_name)) {
                                           echo 
    "File $i: [url='http://webhost.webarrivo.com/upload/$file_name']$file_name[/url] è stato uppato correttamente.
    "

    e mettere e sotto:
    Codice PHP:
    list($width$height$type$attr) = getimagesize("../percorso.gif");
    echo 
    "Larghezza: " .$width"
    "
    ;
    echo 
    "Altezza: " .$height"
    "
    :
    echo 
    "Dimensione: " .filesize("http://webhost.webarrivo.com/upload/$file_name"); 
    e ovviamente tutto sotto tabella, e il codice in php a me verrebbe fuori:

    Codice PHP:
    #-----------------------------------------------------------#
                                       # this function will upload the files.  :) ;) cool          #
                                       #-----------------------------------------------------------#
                                       
    if (move_uploaded_file($file_tmp,$upload_dir.$file_name)) {
                                       
    #-----------------------------------------------------------#
                                       # this function will upload the files.  :) ;) cool          #
                                       #-----------------------------------------------------------#
                                       
    if (move_uploaded_file($file_tmp,$upload_dir.$file_name)) {
                                           echo 
    "File $i: [url='http://webhost.webarrivo.com/upload/$file_name']$file_name[/url] è stato uppato correttamente.
    "
    ;
     echo 
    "<table class='boot' valign="top" style="border0px none background-color:#3399FF; background-image:url('boot.gif'); height:6"> [img]http://webhost.webarrivo.com/upload/$file_name[/img] 
     
    list($width$height$type$attr) = getimagesize("../percorso.gif");
    echo 
    "Larghezza: " .$width"
    "
    ;
    echo 
    "Altezza: " .$height"
    "
    :
    echo 
    "Dimensione: " .filesize("http://webhost.webarrivo.com/upload/$file_name")</table>";

                                       }else{
                                            echo "
    File $iupload fallito.
    ";
                                       }#end of (move_uploaded_file).

                                 }#end of (file_exists).

                           }#end of (file_size).

                     }#end of (limitedext).

               }#end of (!is_uploaded_file).

           }#end of (for loop).
           # print back button.
           echo "
    »<a href=\"$_SERVER[PHP_SELF]\">back</a>";
                                       }else{
                                            echo 
    "File $i: upload fallito.
    "
    ;
                                       }
    #end of (move_uploaded_file).

                                 
    }#end of (file_exists).

                           
    }#end of (file_size).

                     
    }#end of (limitedext).

               
    }#end of (!is_uploaded_file).

           
    }#end of (for loop).
           # print back button.
           
    echo "»<a href=\"$_SERVER[PHP_SELF]\">back</a>"
    Mi sapete dire dove è l'errore? grazie ^^

  2. #2
    allora il primo errore che ho trovato è questo

    Codice PHP:
     echo "<table class='boot' valign="top" style="border0px none background-color:#3399FF; background-image:url('boot.gif'); height:6"> [img]http://webhost.webarrivo.com/upload/$file_name[/img] 
     
    list($width$height$type$attr) = getimagesize("../percorso.gif"); 
    se apri un echo con i doppi apici al suo interno qualsiasi cosa che vuoi aprire con i doppi apici deve essere preceduto da una \ e poi usi una funzione php ( list($width, $height, $type, $attr) ) all'interno dell echo???
    prova così
    Codice PHP:
     echo "<table class='boot' valign=\"top\" style=\"border: 0px none ; background-color:#3399FF; background-image:url('boot.gif'); height:6\"> [img]http://webhost.webarrivo.com/upload/$file_name[/img] 
    "
    ;
    list(
    $width$height$type$attr) = getimagesize("../percorso.gif"); 
    specifica poi l'errore che ti da

  3. #3
    ora ho messo:
    Codice PHP:
                                       if (move_uploaded_file($file_tmp,$upload_dir.$file_name)) {
                                           echo 
    "File $i: [url='http://webhost.webarrivo.com/upload/$file_name']$file_name[/url] è stato uppato correttamente.
    "
    ;
    echo 
    "<table class='boot' valign=\"top\" style=\"border: 0px none ; background-color:#3399FF; background-image:url('boot.gif'); height:6\"> [img]http://webhost.webarrivo.com/upload/$file_name[/img] 
    "
    ;
    list(
    $width$height$type$attr) = getimagesize("http://webhost.webarrivo.com/upload/$file_name"); 
    ho messo come hai detto te, ma non si è risolto nulla http://webhost.webarrivo.com/host2.php

  4. #4
    io nn vedo nulla nella pagina che hai postato

  5. #5
    si, infatti è l'errore che mi dà, visualizzazione bianca.

  6. #6
    bhè grazie se nn gli hai ( tramite un form ) inviato il file dove lui deve copiare sul server e poi stamparti le informazioni...

  7. #7
    il codice completo è:

    Codice PHP:
    <?php
    //upload directory.
    //change to fit your need eg. files, upload .... etc.
    $upload_dir "upload/";
    //number of files to upload.
    $num_files 5;
    //the file size in bytes.
    $size_bytes =5120000//5120000 bytes = 5000KB.
    //Extensions you want files uploaded limited to.
    $limitedext = array(".gif",".jpg",".psd",".psp",".jpeg",".png",".txt",".nfo",".doc",".rtf",".dmg",".zip",".rar",".bmp",".gz");


       
    //check if the directory exists or not.
       
    if (!is_dir("$upload_dir")) {
          die (
    "Error: The directory [b]($upload_dir)[/b] doesn't exist");
       }
       
    //check if the directory is writable.
       
    if (!is_writeable("$upload_dir")){
          die (
    "Error: The directory [b]($upload_dir)[/b] is NOT writable, Please CHMOD (777)");
       }


    //if the form has been submitted, then do the upload process
    //infact, if you clicked on (Upload Now!) button.
    if (isset($_POST['upload_form'])){

           echo 
    "<h3>Upload results:</h3>";

           
    //do a loop for uploading files based on ($num_files) number of files.
           
    for ($i 1$i <= $num_files$i++) {

               
    //define variables to hold the values.
               
    $new_file $_FILES['file'.$i];
               
    $file_name $new_file['name'];
               
    //to remove spaces from file name we have to replace it with "_".
               
    $file_name str_replace(' ''_'$file_name);
               
    $file_tmp $new_file['tmp_name'];
               
    $file_size $new_file['size'];

               
    #-----------------------------------------------------------#
               # this code will check if the files was selected or not.    #
               #-----------------------------------------------------------#

               
    if (!is_uploaded_file($file_tmp)) {
                  
    //print error message and file number.
                  
    echo "File $i: Not selected.
    "
    ;
               }else{
                     
    #-----------------------------------------------------------#
                     # this code will check file extension                       #
                     #-----------------------------------------------------------#

                     
    $ext strrchr($file_name,'.');
                     if (!
    in_array(strtolower($ext),$limitedext)) {
                        echo 
    "File $i: ($file_name) Wrong file extension. 
    "
    ;
                     }else{
                           
    #-----------------------------------------------------------#
                           # this code will check file size is correct                 #
                           #-----------------------------------------------------------#

                           
    if ($file_size $size_bytes){
                               echo 
    "File $i: ($file_name) Faild to upload. File must be [b]"$size_bytes 1024 ."[/b] KB. 
    "
    ;
                           }else{
                                 
    #-----------------------------------------------------------#
                                 # this code check if file is Already EXISTS.                #
                                 #-----------------------------------------------------------#

                                 
    if(file_exists($upload_dir.$file_name)){
                                     echo 
    "File $i: ($file_name) already exists.
    "
    ;
                                 }else{
                                       
    #-----------------------------------------------------------#
                                       # this function will upload the files.  :) ;) cool          #
                                       #-----------------------------------------------------------#
                                       
    if (move_uploaded_file($file_tmp,$upload_dir.$file_name)) {
                                       
    #-----------------------------------------------------------#
                                       # this function will upload the files.  [img]images/smilies/smile.gif[/img] ;) cool          #
                                       #-----------------------------------------------------------#
                                       
    if (move_uploaded_file($file_tmp,$upload_dir.$file_name)) {
                                           echo 
    "File $i: [url='http://webhost.webarrivo.com/upload/$file_name']$file_name[/url] è stato uppato correttamente.
    "
    ;
    echo 
    "<table class='boot' valign=\"top\" style=\"border: 0px none ; background-color:#3399FF; background-image:url('boot.gif'); height:6\"> [img]http://webhost.webarrivo.com/upload/$file_name[/img] 
    "
    ;
    list(
    $width$height$type$attr) = getimagesize("http://webhost.webarrivo.com/upload/$file_name");

                                       }else{
                                            echo 
    "File $i: upload fallito.
    "
    ;
                                       }
    #end of (move_uploaded_file).

                                 
    }#end of (file_exists).

                           
    }#end of (file_size).

                     
    }#end of (limitedext).

               
    }#end of (!is_uploaded_file).

           
    }#end of (for loop).
           # print back button.
           
    echo "»[url="$_SERVER[PHP_SELF]\"]back[/url]";
                                       }else{
                                            echo 
    "File $i: upload fallito.
    "
    ;
                                       }
    #end of (move_uploaded_file).

                                 
    }#end of (file_exists).

                           
    }#end of (file_size).

                     
    }#end of (limitedext).

               
    }#end of (!is_uploaded_file).

           
    }#end of (for loop).
           # print back button.
           
    echo "»<a href=\"$_SERVER[PHP_SELF]\">back</a>";////////////////////////////////////////////////////////////////////////////////
    //else if the form didn't submitted then show it.
    }else{
        echo 
    " <h3>Seleziona il file da uppare.</h3>
               Grandezza massima = "
    $size_bytes 1024 ." KB";
        echo 
    " <form method=\"post\" action=\"$_SERVER[PHP_SELF]\" enctype=\"multipart/form-data\">";
               
    // show the file input field based on($num_files).
               
    for ($i 1$i <= $num_files$i++) {
                   echo 
    "File $i: <input type=\"file\" name=\"file"$i ."\">
    "
    ;
               }
        echo 
    " <input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"$size_bytes\">
               <input type=\"submit\" name=\"upload_form\" value=\"Upload Now!\">
               </form>"
    ;
    }

    //print copyright ;-)



    echo"<p align=\"left\">
    L'hosting ospita correttamente</p>"
    ;$dir "upload/"//La barra in fondo lasciala.
    foreach (glob($dir "*.*") as $filename)
    {
    $count++;
    }
    if (
    $count == 0) {
    echo 
    "Non c'è nessun file nella cartella: " $dir;
    } else {
    echo 
    $count;
    }



    echo
    "<p align=\"right\">
    Script by maaking and Askancy</p>"
    ;
    ?>
    Come vedi il form è dentro alla pagina e come faccio a caricare il file se mi dà pagina bianca?

  8. #8
    lo controllerò e ti farò sapere...leggi i messaggi privati ne hai uno

  9. #9
    ok ti ringrazio moltissimo

  10. #10
    dallo stesso script io ho adattato questo, buono studio:

    Codice PHP:
    <?php
    echo"<body text=\"#000000\" link=\"#000000\" vlink=\"#000000\" alink=\"#000000\">";
    //change to fit your need eg. files, upload .... etc.
    $upload_dir "images/";
    //number of files to upload.
    $num_files 5;
    //the file size in bytes.
    $size_bytes =52428800//51200 bytes = 50KB.
    //Extensions you want files uploaded limited to.
    $limitedext = array(".gif",".jpg",".jpeg",".png",".txt",".nfo",".doc",".rtf",".htm",".dmg",".zip",".rar",".gz",".exe",".rar",".zip");


       
    //check if the directory exists or not.
       
    if (!is_dir("$upload_dir")) {
          die (
    "Error: The directory [b]($upload_dir)[/b] doesn't exist");
       }
       
    //check if the directory is writable.
       
    if (!is_writeable("$upload_dir")){
          die (
    "Error: The directory [b]($upload_dir)[/b] is NOT writable, Please CHMOD (777)");
       }


    //if the form has been submitted, then do the upload process
    //infact, if you clicked on (Upload Now!) button.
    if (isset($_POST['upload_form'])){

           echo 
    "<h3>Upload results:</h3>";

           
    //do a loop for uploading files based on ($num_files) number of files.
           
    for ($i 1$i <= $num_files$i++) {

               
    //define variables to hold the values.
               
    $new_file $_FILES['file'.$i];
               
    $file_name $new_file['name'];
               
    //to remove spaces from file name we have to replace it with "_".
               
    $file_name str_replace(' ''_'$file_name);
               
    $file_tmp $new_file['tmp_name'];
               
    $file_size $new_file['size'];

               
    #-----------------------------------------------------------#
               # this code will check if the files was selected or not.    #
               #-----------------------------------------------------------#

               
    if (!is_uploaded_file($file_tmp)) {
                  
    //print error message and file number.
                  
    echo "File $i: Not selected.
    "
    ;
               }else{
                     
    #-----------------------------------------------------------#
                     # this code will check file extension                       #
                     #-----------------------------------------------------------#

                     
    $ext strrchr($file_name,'.');
                     if (!
    in_array(strtolower($ext),$limitedext)) {
                        echo 
    "File $i: ($file_name) Mi dispiace l'estensione nn è supportata. 
    "
    ;
                     }else{ 
                           
    #-----------------------------------------------------------#
                           # this code will check file size is correct                 #
                           #-----------------------------------------------------------#

                           
    if ($file_size $size_bytes){
                               echo 
    "File $i: ($file_name) Faild to upload. File must be [b]"$size_bytes 1024 ."[/b] KB. 
    "
    ;
                           }else{
                                 
    #-----------------------------------------------------------#
                                 # this code check if file is Already EXISTS.                #
                                 #-----------------------------------------------------------#

                                 
    if(file_exists($upload_dir.$file_name)){
                                      
    //$file_name assegnato dai dati del form...                                 
                                       //$file_name e' img.jpg
                                    
    list($nome,$type) = explode('.',$file_name);
                                     
    $file_name $nome.uniqid().'.'.$type;
                                  if (
    move_uploaded_file($file_tmp,$upload_dir.$file_name)) {
                                           echo 
    "<font color=\"#FF0000\">File $i: ($file_name) Uploaded.
    </font>"
    ;
                                           echo
    "
    "
    ;
                                           echo
    "<a href=\"http://www.oplayers.net/public/upload/images/$file_name\"><img src=\"http://www.oplayers.net/public/upload/images/$file_name\" width=\"119\" height=\"119\" border=\"2\"></a>";
                                           echo
    "

    "
    ;
                                           echo 
    "link html: <input name=\"textfield\" value=\"&lt;img src=&quot;[url]http://www.oplayers.net/public/upload/images/[/url]$file_name&quot;&gt;\" size=\"100\">";
                                           echo
    "
    "
    ;
                                           echo
    "link diretto:<input name=\"textfield\" value=\"http://www.oplayers.net/public/upload/images/$file_name\" size=\"100\">";
                                           echo
    "
    "
    ;
                                           echo
    "Thumbnail:<input name=\"textfield\" type=\"text\" value=\"&lt;a href=&quot;[url]http://www.oplayers.net/public/upload/images/[/url]$file_name&quot;&gt;&lt;img src=&quot;[url]http://www.oplayers.net/public/upload/images/[/url]$file_name&quot; width=&quot;119&quot; height=&quot;119&quot; border=&quot;2&quot;&gt;&lt;/a&gt;\" size=\"100\">

    "
    ;
                                           }
                                 }else{
                                       
    #-----------------------------------------------------------#
                                       # this function will upload the files.  :) ;) cool          #
                                       #-----------------------------------------------------------#
                                       
    if (move_uploaded_file($file_tmp,$upload_dir.$file_name)) {
                                           echo 
    "<font color=\"#FF0000\">File $i: ($file_name) Uploaded.
    </font>"
    ;
                                           echo
    "
    "
    ;
                                           echo
    "<a href=\"http://www.oplayers.net/public/upload/images/$file_name\"><img src=\"http://www.oplayers.net/public/upload/images/$file_name\" width=\"119\" height=\"119\" border=\"2\"></a>";
                                           echo
    "

    "
    ;
                                           echo 
    "link html: <input name=\"textfield\" value=\"&lt;img src=&quot;[url]http://www.oplayers.net/public/upload/images/[/url]$file_name&quot;&gt;\" size=\"100\">";
                                           echo
    "
    "
    ;
                                           echo
    "link diretto:<input name=\"textfield\" value=\"http://www.oplayers.net/public/upload/images/$file_name\" size=\"100\">";
                                           echo
    "
    "
    ;
                                           echo
    "Thumbnail:<input name=\"textfield\" type=\"text\" value=\"&lt;a href=&quot;[url]http://www.oplayers.net/public/upload/images/[/url]$file_name&quot;&gt;&lt;img src=&quot;[url]http://www.oplayers.net/public/upload/images/[/url]$file_name&quot; width=&quot;119&quot; height=&quot;119&quot; border=&quot;2&quot;&gt;&lt;/a&gt;\" size=\"100\">

    "
    ;
                                                                              }else{
                                            echo 
    "File $i: Faild to upload.
    "
    ;
                                       }
    #end of (move_uploaded_file).

                                 
    }#end of (file_exists).

                           
    }#end of (file_size).

                     
    }#end of (limitedext).

               
    }#end of (!is_uploaded_file).

           
    }#end of (for loop).
           # print back button.
           
    echo"
    "
    ;
           
           echo
    "
    "
    ;
           echo 
    "»<a href=\"$_SERVER[PHP_SELF]\">back</a>";
    ////////////////////////////////////////////////////////////////////////////////
    //else if the form didn't submitted then show it.
    }else{
        echo 
    " <h3>Scegli il file da caricare.</h3>
               Max file size = "
    $size_bytes 1024 ." KB";
        echo 
    " <form method=\"post\" action=\"$_SERVER[PHP_SELF]\" enctype=\"multipart/form-data\">";
               
    // show the file input field based on($num_files).
               
    for ($i 1$i <= $num_files$i++) {
                   echo 
    "File $i: <input type=\"file\" name=\"file"$i ."\">
    "
    ;
               }
        echo 
    " <input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"$size_bytes\">
               <input type=\"submit\" name=\"upload_form\" value=\"Upload Now!\">
               </form>"
    ;
    }

    //print copyright ;-)
    echo"<noscript><img src=\"$i\"></noscript>";
    echo

     Il file è raggiungibile a [url]www.oplayers.net/public/upload/images/tuofile.estensione[/url]"
    ;
    ?>
    SCSA rulez

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.