Гость
Форумы / PHP, Perl, Python [игнор отключен] [закрыт для гостей] / PHP Upload файл. / 4 сообщений из 4, страница 1 из 1
13.11.2003, 02:28
    #32322293
JhonDoe
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
PHP Upload файл.
приветствую.
может кто-нибудь подскажет как сделать или где найти пример скрипта который реализует пересылку файла с компьютера пользователя на компьютер администратора сайта через web-форму. Ну что бы в общем аттачем пришёл этот файл в письме с помощью mail? А то делаю и не получается, приходят постоянно какие-то файлы с кривыми именами... помогите плиз!
...
Рейтинг: 0 / 0
13.11.2003, 10:26
    #32322500
©Felix
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
PHP Upload файл.
Example 4-4. File Upload Form

<FORM ENCTYPE="multipart/form-data" ACTION="_URL_" METHOD=POST>
<INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="1000">
Send this file: <INPUT NAME="userfile" TYPE="file">
<INPUT TYPE="submit" VALUE="Send File">
</FORM>


The _URL_ should point to a php html file. The MAX_FILE_SIZE hidden field must precede the file input field and its value is the maximum filesize accepted. The value is in bytes. In this destination file, the following variables will be defined upon a successful upload:



$userfile - The temporary filename in which the uploaded file was stored on the server machine.

$userfile_name - The original name of the file on the sender's system.

$userfile_size - The size of the uploaded file in bytes.

$userfile_type - The mime type of the file if the browser provided this information. An example would be "image/gif".

Note that the "$userfile" part of the above variables is whatever the name of the INPUT field of TYPE=file is in the upload form. In the above upload form example, we chose to call it "userfile".

а для имени..
$path= "/home/mydir/myfile.txt";
$file= basename($path); //return: myfile.txt

Felix
...
Рейтинг: 0 / 0
13.11.2003, 13:04
    #32322867
Макс М.
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
PHP Upload файл.
http://detail.phpclub.net/article/upload
http://detail.phpclub.net/article/mail
...
Рейтинг: 0 / 0
13.11.2003, 20:58
    #32323714
antonprk
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
PHP Upload файл.
Сам скрипт так работает:
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
 $boundary = uniqid(  "");

 $headers =" From: адрес\r\n ";
 $headers.=" Content-type: multipart/mixed; charset=windows- 1251 ; boundary=\ "$boundary\"  ";

 $emailBody ="  --$boundary\r\n";
 
 $emailBody.= "Content-Type: text/plain; charset=windows-1251 \r\n";
 $emailBody.= "Content-transfer-encoding: 8bit\r\n" ;
 $emailBody.= "\r\n" ;
 $emailBody.= "файлик" ;
 $emailBody.= "\r\n" ;
 $emailBody.= "--$boundary--";
 

 $result=mail($email,"Копия ",$emailBody,$headers);
...
Рейтинг: 0 / 0
Форумы / PHP, Perl, Python [игнор отключен] [закрыт для гостей] / PHP Upload файл. / 4 сообщений из 4, страница 1 из 1
Целевая тема:
Создать новую тему:
Автор:
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]