文件上传网站的问题(100)

  • 主题发起人 主题发起人 ocean7
  • 开始时间 开始时间
O

ocean7

Unregistered / Unconfirmed
GUEST, unregistred user!
网址是http://virscan.org/ 我想提交文件给它用代码,但是我不知道提交那些参数! procedure TForm1.Button1Click(Sender: TObject); var IdHTTP1: tidhttp; ResponseStream: TMemoryStream; strme: Tstringstream; str: string; MultiPartFormDataStream: TMsMultiPartFormDataStream; begin IdHTTP1 := tidhttp.create(nil); MultiPartFormDataStream := TMsMultiPartFormDataStream.Create; ResponseStream := TMemoryStream.Create; IdHttp1.Request.ContentType := MultiPartFormDataStream.RequestContentType; // MultiPartFormDataStream.AddFormField('file', 'c:/a.exe'); // MultiPartFormDataStream.AddFormField('upload_button', '上 传'); MultiPartFormDataStream.AddFile('file', 'c:/a.exe', 'multipart/form-data'); MultiPartFormDataStream.PrepareStreamForDispatch; MultiPartFormDataStream.Position := 0; //调用idhttp的post方法,第一个参数是用于处理上载form的asp/php等等脚本,第三个是接收脚本执行完成后的返回内容) IdHTTP1.Post('http://virscan.org/cgi-bin/upload.cgi?sid=36c26870a82dfc385d341551fb8bf720', MultiPartFormDataStream, ResponseStream); // ResponseStream.SaveToStream(strme); showmessage(StreamToText(ResponseStream)); MultiPartFormDataStream.Free; ResponseStream.Free; end;
 
后退
顶部