Форум АНТИЧАТ

Форум АНТИЧАТ (https://forum.antichat.xyz/index.php)
-   PHP, PERL, MySQL, JavaScript (https://forum.antichat.xyz/forumdisplay.php?f=37)
-   -   file upload?... (https://forum.antichat.xyz/showthread.php?t=84311)

forik 10.09.2008 16:51

file upload?...
 
Всем привет.
Помогите найти скрипт загрузки фаилов на сервер.
скрипт должен состоять в одном пхп скрипте.

P3L3NG 10.09.2008 16:56

http://phpclub.ru/detail/article/upload

forik 10.09.2008 16:59

Цитата:

Сообщение от P3L3NG
http://phpclub.ru/detail/article/upload

....там идёт форма а потом php скрипт.А мне надо чтобы всё в одном было.

P3L3NG 10.09.2008 17:04

соедини в одно

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

Gifts 10.09.2008 17:06

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!";
}
}
?>



Время: 00:12