Visualizzazione dei risultati da 1 a 8 su 8

Discussione: Upload File

  1. #1

    Upload File

    Ciao a tutti

    Vengo subito al dunque anche perchè sono disperato

    Sto creando un' interazione tra visual basic e php, mi servirebbe il codice per uploadare un file in un server: ho utilizzato questo ma non funziona:

    <?php

    @copy("C:\file.txt", "/Cartella/file.txt");

    ?>

    Potete dirmi dove sbaglio e sopratutto esiste questo codice

  2. #2

    Re: Upload File

    @copy("C:\file.txt", "/Cartella/file.txt");


    e certo, cosi' da un sito posso prendere un programma dal pc dell' utente, posso copiarmi i suoi registri windows, posso prendergli le email e le password salvate, geniale


    impossibile fare quello che vuoi fare, ti serve un form di upload dove il navigatore, ovviamente, sceglie cosa uploadare, no che tu da un sito mi copi i files sul tuo server ... difficile anche solo da pensare ( tutti avrebbero il disco condiviso ... ) e anti privacy al 500%


    detto quersto, o cerchi form di upload oppure chiedi in vb come fare
    Formaldehyde a new Ajax PHP Zero Config Error Debugger

    WebReflection @WebReflection

  3. #3

    MHA

    Potresti spiegarmi come funziona? se in visual basic c'è un metodo è molto complicato metterlo in funzione

    Si potrebbe fare sonza un form? cioè direttamente l'upload

  4. #4
    se tu stai facendo un applicativo in VB che gira in locale devi interfacciarti con PHP via http ... e non usare PHP in locale ...

    esempio ( non so una cippa di VB )

    miavarfile = "C:\\file.txt";

    a questo punto in VB dovresti fare una request, tramite socket o tramite chiamata in POST all' url dove sta' il file PHP ... il quale lavorera' sul

    $_FILE

    variabile inviata via post tramite un form in encode multipart from data ...

    non e' semplice da spiegare, o meglio, semplice la parte in PHP, impossibile, per me e qui, la parte in VB che pesno sia la piu' importante.
    Formaldehyde a new Ajax PHP Zero Config Error Debugger

    WebReflection @WebReflection

  5. #5
    Allora io ho il sorgente dell' upload php sul server e lo dovrei richiamare da vb.

    Ma cosa ci dovrebbe essere scritto nel file per l'upload del file? :master: :master: :master:

    Non pensiamo a visual basic per me ora mi serve un script che upload i file...

  6. #6
    [supersaibal]Originariamente inviato da Dimensione
    Non pensiamo a visual basic per me ora mi serve un script che upload i file... [/supersaibal]
    allora ti serve una pagina web con un form di upload

    http://forum.html.it/forum/search.ph...by=&sortorder=
    Formaldehyde a new Ajax PHP Zero Config Error Debugger

    WebReflection @WebReflection

  7. #7
    Si però non me ne funziona neanche uno

    Ad esempio ne prendo uno semplice semplice:

    <?
    $sizelimit = "no"; //Do you want a size limit, yes or no?
    $sizebytes = "200000"; //size limit in bytes
    $dl = "http://www.sito.altervista.org/Cartella/"; //url where files are uploaded
    $absolute_path = "/Cartella/"; //Absolute path to where files are uploaded
    $websiteurl = "http://www.sito.altervista.org"; //Url to you website
    $websitename = "Zach White Network";

    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.zachwhite.com/>PHP Uploader Downloader</a>
    </body>
    </html>";
    break;
    case "download":
    echo "
    <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.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>


    File to upload:

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


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



    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.");
    }


    @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.zachwhite.com/>PHP Uploader Downloader</a>
    </body>
    </html>";
    break;

    }
    ?>

    E mi esce sempre che non è riuscito a uploadare il file
    Magari sbaglio qui:

    $sizelimit = "no"; //Do you want a size limit, yes or no?
    $sizebytes = "200000"; //size limit in bytes
    $dl = "http://www.sito.altervista.org/Cartella/"; //url where files are uploaded
    $absolute_path = "/Cartella/"; //Absolute path to where files are uploaded
    $websiteurl = "http://www.sito.altervista.org"; //Url to you website
    $websitename = "Zach White Network";

  8. #8
    hai preso l' esempio peggiore ... scritto non molto bene e soprattutto vecchio ....

    $PHP_SELF non esiste piu' da anni .... magari con

    $_SERVER['PHP_SELF']

    qualcosa si muove
    Formaldehyde a new Ajax PHP Zero Config Error Debugger

    WebReflection @WebReflection

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.