file upload?...

Discussion in 'PHP' started by forik, 10 Sep 2008.

  1. forik

    forik New Member

    Joined:
    5 Nov 2007
    Messages:
    29
    Likes Received:
    0
    Reputations:
    0
    Всем привет.
    Помогите найти скрипт загрузки фаилов на сервер.
    скрипт должен состоять в одном пхп скрипте.
     
  2. P3L3NG

    P3L3NG Banned

    Joined:
    4 Jun 2008
    Messages:
    175
    Likes Received:
    204
    Reputations:
    11
    http://phpclub.ru/detail/article/upload
     
  3. forik

    forik New Member

    Joined:
    5 Nov 2007
    Messages:
    29
    Likes Received:
    0
    Reputations:
    0
    ....там идёт форма а потом php скрипт.А мне надо чтобы всё в одном было.
     
  4. P3L3NG

    P3L3NG Banned

    Joined:
    4 Jun 2008
    Messages:
    175
    Likes Received:
    204
    Reputations:
    11
    соедини в одно

    просто копипастишь форму в скрипт и в <form> стираешь параметр "action"
     
  5. Gifts

    Gifts Green member

    Joined:
    25 Apr 2008
    Messages:
    2,494
    Likes Received:
    807
    Reputations:
    614
    forik да, наверное очень сложно объеденить пхп и хтмл....

    PHP:
    <form enctype="multipart/form-data" method="post">
    <input type="hidden" name="MAX_FILE_SIZE" value="30000">
    Send this file: <input name="userfile" type="file">
    <input type="submit" value="Send File">
    </form>
    <? if (isset($_POST['userfile']))
    {
    $uploaddir = '/var/www/uploads/';
    if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploaddir . 
        $_FILES['userfile']['name'])) {
        print "File is valid, and was successfully uploaded.";
    } else {
        print "There some errors!";
    }
    }
    ?>
     
    _________________________