+ Responder ao Tópico



  1. #1
    marcfee
    Visitante

    Padrão PHP Upload

    Galera,
    O como eu faço para que as pessoas que acessem meu site consigam fazer upload de arquivos no meu servidor mas também restringir com senha.
    Não manjo nada de PHP, alguém tem alguma coisa promto, alguma dica, etc..

    Grato,
    Marcfee

  2. #2
    AndrewAmorimdaSilva
    Visitante

    Padrão PHP Upload

    Bom para uploads.

    No php.ini, localize a linha e deixe:

    file_uploads = on

    Agora o acesso...

    Um abraço!!! <IMG SRC="images/forum/icons/icon_wink.gif">



  3. #3
    Neckratal
    Visitante

    Padrão PHP Upload

    Se vc precisar eu tenho um script de upload aqui

    <IMG SRC="images/forum/icons/icon21.gif">

  4. #4
    marcfee
    Visitante

    Padrão PHP Upload

    Tem como vc me passar esse script?



  5. #5
    Neckratal
    Visitante

    Padrão PHP Upload

    Esta aqui o arq. html e o php

    =================================form.html==[filename]

    <html>
    <head>
    <title>Administration - upload new files</title>


    </head>
    <body>
    <h1>Upload new news files</h1>
    <form enctype="multipart/form-data" action="upload.php" method=post>
    <input type="hidden" name="MAX_FILE_SIZE" value="1000">
    Upload this file: <input name="userfile" type="file">
    <input type="submit" value="Send File">
    </form>
    </body>
    </html>
    ================================================[]



    #=================================Upload.php==[filename]
    <?
    // $userfile is where file went on webserver
    // $userfile_name is original file name
    // $userfile_size is size in bytes
    // $userfile_type is mime type e.g. image/gif

    /* echo "Variables are:<br>";
    echo $userfile." ".$userfile_name." ".$userfile_size." ".$userfile_type."<br>";
    */

    if ($userfile=="none&quot<IMG SRC="images/forum/icons/icon_wink.gif">
    {
    echo "Problem: no file uploaded";
    exit;
    }

    if ($userfile_size==0)
    {
    echo "Problem: uploaded file is zero length";
    exit;
    }

    if ($userfile_type != "text/plain&quot<IMG SRC="images/forum/icons/icon_wink.gif">
    {
    echo "Problem: file is not plain text";
    exit;
    }

    $upfile = "/home/book/uploads/".$userfile_name;

    if ( !copy($userfile, $upfile))
    {
    echo "Problem: Could not move file into directory";
    exit;
    }


    echo "File uploaded successfully<br><br>";
    $fp = fopen($upfile, "r&quot<IMG SRC="images/forum/icons/icon_wink.gif">;
    $contents = fread ($fp, filesize ($upfile));
    fclose ($fp);

    $contents = strip_tags($contents);
    $fp = fopen($upfile, "w&quot<IMG SRC="images/forum/icons/icon_wink.gif">;
    fwrite($fp, $contents);
    fclose($fp);

    echo "Preview of uploaded file contents:<br><hr>";
    echo $contents;
    echo "<br><hr>";

    ?>
    ===============================================[]


  6. #6
    marcfee
    Visitante

    Padrão PHP Upload

    Valeu vou testar...
    <IMG SRC="images/forum/icons/icon_wink.gif">



  7. #7
    marcfee
    Visitante

    Padrão PHP Upload

    Eu coloquei os scripts no meu site e está dando o seguinte erro
    [filename] Problem: no file uploaded