searching for a way to upload files to my site

Discussion in 'Programming' started by Paradaxon, Mar 8, 2009.

  1. #1
    Hallo people
    im searching for a way to upload files to my webspace in the internet.
    without FTP programs.

    for example to make a page und with browse button and to put the file and to upload it to a folder in my servers.

    how can i do this ?

    THank you:D
     
    Paradaxon, Mar 8, 2009 IP
  2. NuLLByTe

    NuLLByTe Active Member

    Messages:
    382
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    80
    #2
    index.html:

    <form enctype="multipart/form-data" action="upload.php" method="POST">
    Please choose a file: <input name="uploaded" type="file" /><br />
    <input type="submit" value="Upload" />
    </form> 
    HTML:
    upload.php:
    
    <?php
    $target = "upload/";
    $target = $target . basename( $_FILES['uploaded']['name']) ;
    $ok=1;
    if ($uploaded_size > 350000)
    {
    echo "Your file is too large.<br>";
    $ok=0;
    }
    if ($uploaded_type =="text/php")
    {
    echo "No PHP files<br>";
    $ok=0;
    }
    
    //Here we check that $ok was not set to 0 by an error
    if ($ok==0)
    {
    Echo "Sorry your file was not uploaded";
    }
    else
    {
    if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
    {
    echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded";
    }
    else
    {
    echo "Sorry, there was a problem uploading your file.";
    }
    }
    ?> 
    PHP:
    via About.com
     
    NuLLByTe, Mar 8, 2009 IP