Форум по Delphi программированию

Delphi Sources



Вернуться   Форум по Delphi программированию > Все о Delphi > Интернет и сети
Ник
Пароль
Регистрация <<         Правила форума         >> FAQ Пользователи Календарь Поиск Сообщения за сегодня Все разделы прочитаны

Ответ
 
Опции темы Поиск в этой теме Опции просмотра
  #1  
Старый 06.06.2007, 08:26
snake-yava snake-yava вне форума
Прохожий
 
Регистрация: 06.06.2007
Сообщения: 4
Репутация: 10
Вопрос Upload файлов на сервер

Помогите, пожалуйста! Как выглядит запрос вот от этой формы?

Код:
<FORM action=http://snake-yava.mylivepage.ru/file method=post encType=multipart/form-data> 
<DIV id=all_window_2><MLP_WINDOW_START> 
<TABLE cellSpacing=0 cellPadding=4 width="100%"> 
<TBODY> 
<TR vAlign=top> 
<TD> 
<TABLE height=21 cellSpacing=0 cellPadding=0 width="100%" bgColor=#cccccc border=0> 
<TBODY> 
<TR> 
<TD width=10 background=http://common.mylivepage.com/style28/pan_l.gif>&nbsp;</TD> 
<TD background=http://common.mylivepage.com/style28/pan_c.gif><STRONG> 
<DIV> 
<DIV style="FLOAT: left">Множественная загрузка файлов</DIV> 
<DIV style="FLOAT: right"><A onclick="this.blur(); return mlp_toggle_window('window_2');" href="#"><SPAN class=window_minimize><FONT size=+0>_</FONT></SPAN></A></DIV></DIV></STRONG></TD> 
<TD width=10 background=http://common.mylivepage.com/style28/pan_r.gif>&nbsp;</TD></TR></TBODY></TABLE> 
<TABLE style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: 0px; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" cellSpacing=0 cellPadding=4 width="100%" bgColor=#ffffff border=0> 
<TBODY> 
<TR> 
<TD vAlign=top bgColor=#fcfcfc> 
<DIV id=window_2></FORM> 
<FORM onsubmit="wait_button('add_multifile_submit','add_multifile_action','1')" action=http://snake-yava.mylivepage.ru/file method=post encType=multipart/form-data> 
<SCRIPT language=JavaScript type=text/javascript>
function wait_button(id,hidden_id,wait_block)
{
document.getElementById(id).disabled=true;
document.getElementById(hidden_id).disabled=false;
if (wait_block=="1")
waitDiv_show(); 
document.getElementById(id).value="ПОДОЖДИТЕ";
}

</SCRIPT> 
Имя файла 1: <INPUT class="" style="WIDTH: 70%" type=file size=maxlength= name=file_subject[]><BR>Имя файла 2: <INPUT class="" style="WIDTH: 70%" type=file size=maxlength= name=file_subject[]><BR>Имя файла 3: <INPUT class="" style="WIDTH: 70%" type=file size=maxlength= name=file_subject[]><BR>Имя файла 4: <INPUT class="" style="WIDTH: 70%" type=file size=maxlength= name=file_subject[]><BR>Имя файла 5: <INPUT class="" style="WIDTH: 70%" type=file size=maxlength= name=file_subject[]><BR>Имя файла 6: <INPUT class="" style="WIDTH: 70%" type=file size=maxlength= name=file_subject[]><BR>Имя файла 7: <INPUT class="" style="WIDTH: 70%" type=file size=maxlength= name=file_subject[]><BR>Имя файла 8: <INPUT class="" style="WIDTH: 70%" type=file size=maxlength= name=file_subject[]><BR>Имя файла 9: <INPUT class="" style="WIDTH: 70%" type=file size=maxlength= name=file_subject[]><BR><BR>Имя папки: <SELECT name=file_folder_id><OPTION value=518 selected>Программы для смартфонов - ФОТО</OPTION><OPTION value=519>Программы для смартфонов - ИНТЕРНЕТ</OPTION><OPTION value=520>Программы для смартфонов - МЕДИА</OPTION><OPTION value=521>Программы для смартфонов - ОФИС</OPTION><OPTION value=522>Программы для смартфонов - ОФОРМЛЕНИЕ</OPTION><OPTION value=523>Программы для смартфонов - ЗАЩИТА СМАРТА</OPTION><OPTION value=524>Программы для смартфонов - РАЗНОЕ</OPTION><OPTION value=525>Программы для смартфонов - СИСТЕМНЫЕ</OPTION><OPTION value=528>ROCK-ZONA / GTP-files / АРИЯ</OPTION><OPTION value=529>ROCK-ZONA / GTP-files / МАВРИН</OPTION><OPTION value=530>ROCK-ZONA / GTP-files / КИПЕЛОВ</OPTION><OPTION value=547>ROCK-ZONA / GTP-files</OPTION><OPTION value=558>ROCK-ZONA / Книги</OPTION><OPTION value=411>Общие</OPTION></SELECT><BR><BR><INPUT type=checkbox CHECKED name=file_close>Разрешить оставлять комментарии<BR>Метки (Вводить через запятую)<BR><INPUT class="" id="" style="WIDTH: 100%" maxLength=1000 size=10 name=message_tags><BR> 
<DIV id=all_window_1><MLP_WINDOW_START> 
<TABLE cellSpacing=0 cellPadding=4 width="100%"> 
<TBODY> 
<TR vAlign=top> 
<TD> 
<TABLE height=21 cellSpacing=0 cellPadding=0 width="100%" bgColor=#cccccc border=0> 
<TBODY> 
<TR> 
<TD width=10 background=http://common.mylivepage.com/style28/pan_l.gif>&nbsp;</TD> 
<TD background=http://common.mylivepage.com/style28/pan_c.gif><STRONG> 
<DIV> 
<DIV style="FLOAT: left"><IMG class=img_access id="" title=image alt=image src="http://common.mylivepage.com/img/access.gif" border=0></DIV> 
<DIV style="FLOAT: right"><A onclick="this.blur(); return mlp_toggle_window('window_1');" href="#"><SPAN class=window_minimize><FONT size=+0>_</FONT></SPAN></A></DIV></DIV></STRONG></TD> 
<TD width=10 background=http://common.mylivepage.com/style28/pan_r.gif>&nbsp;</TD></TR></TBODY></TABLE> 
<TABLE style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: 0px; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" cellSpacing=0 cellPadding=4 width="100%" bgColor=#ffffff border=0> 
<TBODY> 
<TR> 
<TD vAlign=top bgColor=#fcfcfc> 
<DIV id=window_1><A id=access_full_link href="javascript:toggleAccessFull()">Права Доступа...</A> 
<DIV id=access_full style="DISPLAY: none"> 
<TABLE class=TableBody cellSpacing=0 cellPadding=0 width="100%"> 
<TBODY> 
<TR> 
<TD class=InnerHead vAlign=top width="20%">&nbsp;Кто?/Что?</TD> 
<TD class=InnerHead vAlign=top width="20%">&nbsp;Читать запись</TD> 
<TD class=InnerHead vAlign=top width="20%">&nbsp;Редактировать запись</TD></TR> 
<TR class=OneLine onmouseover="this.className='OverLine'" onmouseout="this.className='OneLine'"> 
<TD class=TableBody vAlign=top width="20%">Для всех</TD> 
<TD class=TableBody vAlign=top width="20%"><INPUT class="" type=checkbox CHECKED value="" name=access_read1></TD> 
<TD class=TableBody vAlign=top width="20%"><INPUT class="" type=checkbox value="" name=access_write1></TD></TR> 
<TR class=TwoLine onmouseover="this.className='OverLine'" onmouseout="this.className='TwoLine'"> 
<TD class=TableBody vAlign=top width="20%">Для зарегистрированных пользователей</TD> 
<TD class=TableBody vAlign=top width="20%"><INPUT class="" type=checkbox value="" name=access_read30></TD> 
<TD class=TableBody vAlign=top width="20%"><INPUT class="" type=checkbox value="" name=access_write30></TD></TR> 
<TR class=OneLine onmouseover="this.className='OverLine'" onmouseout="this.className='OneLine'"> 
<TD class=TableBody vAlign=top width="20%">Для друзей</TD> 
<TD class=TableBody vAlign=top width="20%"><INPUT class="" type=checkbox value="" name=access_read2></TD> 
<TD class=TableBody vAlign=top width="20%"><INPUT class="" type=checkbox value="" name=access_write2></TD></TR> 
<TR class=TwoLine onmouseover="this.className='OverLine'" onmouseout="this.className='TwoLine'"> 
<TD class=TableBody vAlign=top width="20%">Для модераторов</TD> 
<TD class=TableBody vAlign=top width="20%"><INPUT class="" type=checkbox value="" name=access_read29></TD> 
<TD class=TableBody vAlign=top width="20%"><INPUT class="" type=checkbox value="" name=access_write29></TD></TR></TBODY></TABLE></DIV> 
<SCRIPT type=text/javascript>
function changeTextAccess(el, newText) {
// Safari work around
if (el.innerText)
el.innerText = newText;
else if (el.firstChild && el.firstChild.nodeValue)
el.firstChild.nodeValue = newText;
}


function toggleAccessFull() {
var toc = document.getElementById('access_full');
var toggleLink = document.getElementById('access_full_link')

changeTextAccess(toggleLink, '');
toc.style.display = 'block';
}
</SCRIPT> 
</DIV></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></DIV><INPUT id=add_multifile_action disabled type=hidden name=add_multifile_action><INPUT id=add_multifile_submit type=submit value=Загрузить name=add_multifile_action> 
<DIV id=waitDiv style="LEFT: 40%; VISIBILITY: hidden; POSITION: absolute; TOP: 50%; TEXT-ALIGN: center"> 
<TABLE borderColor=#000000 cellPadding=6 bgColor=#eeeeee border=2> 
<TBODY> 
<TR> 
<TD align=middle><FONT color=#000000><B><BIG>ПОДОЖДИТЕ</BIG></B><BR><IMG class=img_loading title="идёт загрузка файлов..." alt="идёт загрузка файлов..." src="http://common.mylivepage.com/img/loading.gif" border=0><BR>идёт загрузка файлов... </FONT></TD></TR></TBODY></TABLE></DIV> 
<SCRIPT type=text/javascript>
var ie=document.all
var dom=document.getElementById
function waitDiv_show()
{
scroll_top=(ie)? truebody_wait().scrollTop : window.pageYOffset
document.getElementById("waitDiv").style.top=scroll_top+250
document.getElementById("waitDiv").style.visibility=(dom||ie)? "visible" : "show"
}
function truebody_wait()
{
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
</SCRIPT> 
</DIV></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></DIV></FORM> 
Ответить с цитированием
  #2  
Старый 06.06.2007, 08:28
snake-yava snake-yava вне форума
Прохожий
 
Регистрация: 06.06.2007
Сообщения: 4
Репутация: 10
По умолчанию upload

Хочу написать загрузчик файлов, только не знаю как выглядит запрос который серверу посылается...
Код:
procedure TForm1.Button1Click(Sender: TObject);
var
  Flags, TargetFrameName, PostData, Headers: OleVariant;
  S: String;
begin
file1:=edit1.text;file2:=edit2.text;file3:=edit3.text;file4:=edit4.text;
file5:=edit5.text;file6:=edit6.text;file7:=edit7.text;file8:=edit8.text;
file9:=edit9.text;
folderID:=edit10.text;
if checkbox1.Checked then file_close:='CHECKED' else file_close:='UNCHECKED';
metki:=edit11.text;
if checkbox2.Checked then all_read1:='CHECKED' else all_read1:='UNCHECKED';
if checkbox3.Checked then all_write1:='CHECKED' else all_write1:='UNCHECKED';
if checkbox4.Checked then reg_read30:='CHECKED' else reg_read30:='UNCHECKED';
if checkbox5.Checked then reg_write30:='CHECKED' else reg_write30:='UNCHECKED';
if checkbox6.Checked then frnds_read2:='CHECKED' else frnds_read2:='UNCHECKED';
if checkbox7.Checked then frnds_write2:='CHECKED' else frnds_write2:='UNCHECKED';
if checkbox8.Checked then moder_read29:='CHECKED' else moder_read29:='UNCHECKED';
if checkbox9.Checked then moder_write29:='CHECKED' else moder_write29:='UNCHECKED';

    S := Format('file_subject[]=%s&file_subject[]=%s&file_subject[]=%s&'+
    'file_subject[]=%s&file_subject[]=%s&file_subject[]=%s&file_subject[]=%s&'+
    'file_subject[]=%s&file_subject[]=%s&file_folder_id=%s&file_close=%s&'+
    'message_tags=%s&access_read1=%s&access_write1=%s&access_read30=%s&'+
    'access_write30=%s&access_read2=%s&access_write2=%s&access_read29=%s&'+
    'access_write29=%s&add_multifile_action',
    [file1,file2,file3,file4,file5,file6,file7,file8,file9,folderID,file_close,metki,all_read1,all_write1,reg_read30,reg_write30,frnds_read2,frnds_write2,moder_read29,moder_write29]);
    PostData := VarArrayCreate([1, Length(S) + 1], varByte);
    System.Move(S[1], VarArrayLock(PostData)^, Length(S) + 1);
    VarArrayUnlock(PostData);
    Headers :='Content-Type: multipart/form-data'#10#13;
    WebBrowser1.Navigate('http://snake-yava.mylivepage.ru/file', Flags,TargetFrameName, PostData, Headers);

end;
Ответить с цитированием
  #3  
Старый 06.06.2007, 18:36
Аватар для mav_c
mav_c mav_c вне форума
Активный
 
Регистрация: 26.03.2007
Адрес: Москва
Сообщения: 287
Репутация: 30
По умолчанию

Заполни этот HTTP пакет и передай его на сервер
Код:
POST http://snake-yava.mylivepage.ru/file HTTP/1.0
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/msword, application/vnd.ms-excel, */*
Accept-Language: ru
Content-Type: multipart/form-data; boundary=---------------------------7d733c14b02fc
Pragma: no-cache
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 1.0.3705; .NET CLR 2.0.50727)
Host: snake-yava.mylivepage.ru
Content-Length: 1977
Proxy-Connection: Keep-Alive
-----------------------------7d733c14b02fc
Content-Disposition: form-data; name="file_subject[]"; filename=""
Content-Type: application/octet-stream
-----------------------------7d733c14b02fc
Content-Disposition: form-data; name="file_subject[]"; filename=""
Content-Type: application/octet-stream
-----------------------------7d733c14b02fc
Content-Disposition: form-data; name="file_subject[]"; filename=""
Content-Type: application/octet-stream
-----------------------------7d733c14b02fc
Content-Disposition: form-data; name="file_subject[]"; filename=""
Content-Type: application/octet-stream
-----------------------------7d733c14b02fc
Content-Disposition: form-data; name="file_subject[]"; filename=""
Content-Type: application/octet-stream
-----------------------------7d733c14b02fc
Content-Disposition: form-data; name="file_subject[]"; filename=""
Content-Type: application/octet-stream
-----------------------------7d733c14b02fc
Content-Disposition: form-data; name="file_subject[]"; filename=""
Content-Type: application/octet-stream
-----------------------------7d733c14b02fc
Content-Disposition: form-data; name="file_subject[]"; filename=""
Content-Type: application/octet-stream
-----------------------------7d733c14b02fc
Content-Disposition: form-data; name="file_subject[]"; filename=""
Content-Type: application/octet-stream
-----------------------------7d733c14b02fc
Content-Disposition: form-data; name="file_folder_id"
518
-----------------------------7d733c14b02fc
Content-Disposition: form-data; name="file_close"
on
-----------------------------7d733c14b02fc
Content-Disposition: form-data; name="message_tags"
-----------------------------7d733c14b02fc
Content-Disposition: form-data; name="access_read1"
-----------------------------7d733c14b02fc
Content-Disposition: form-data; name="add_multifile_action"
Çàãðóçèòü
-----------------------------7d733c14b02fc--
__________________
---------------------------------------------
Программирование - не профессия, а стиль жизни
Ответить с цитированием
Ответ


Delphi Sources

Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

Ваши права в разделе
Вы не можете создавать темы
Вы не можете отвечать на сообщения
Вы не можете прикреплять файлы
Вы не можете редактировать сообщения

BB-коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход


Часовой пояс GMT +3, время: 13:59.


 

Сайт

Форум

FAQ

Соглашения

Прочее

 

Copyright © Форум "Delphi Sources" by BrokenByte Software, 2004-2025