如何用HTTP协议上传下载文件

localmaple 2005-12-14 09:57:47
例如将http://www.myweb.com/a.rar下载到本地电脑中,反之上传呢!
基本原理可以讲讲吗?
用TIdHTTP控件可以吗?
分不够还可以再加。
...全文
229 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
我不懂电脑 2005-12-15
  • 打赏
  • 举报
回复
用TNMHTTP的GET和PUT方法。
TNMHTTP component

Declaration

procedure Put(URL, PutData: string); virtual;

Description

The Put method is used to create documents on an HTTP server.

Parameters:

The URL parameter specifies the document to create on the remote HTTP server.

If the OutputFileMode property is TRUE, the PutData parameter specifies a file to read the data out of to create the document on the remote host.

If the OutputFileMode property is FALSE, the PutData parameter contains the data that will be put into the newly created document on the remote host.

Notes:

For this method to work correctly, you must have rights to write on the host you are creating the document on.

If this method executes successfully, the OnSuccess event is called, passing CmdPUT as the Cmd parameter.

If this method fails to execute successfully, the OnFailure event is called, passing CmdPUT as the Cmd parameter.

TNMHTTP component

Declaration

procedure Get(URL: string); virtual;

Description

The Get method retrieves the document specified by the URL parameter.

If InputFileMode is TRUE, the document retrieved by the Get method is stored in the file that is specified by the Body property, and the header is stored in the file that is specified by the Header property.

If InputFileMode is FALSE, the document retrieved by the Get method is stored in the Body property as a string. The header is stored in the Header property as a string.

Parameters:

The URL parameter specifies the document to retrieve.

Note:

If the operation is successful, the OnSuccess event is called, passing CmdGET as the Cmd parameter.

If the operation fails, the OnFailure event is called, passing CmdGET as the Cmd parameter.
编译失败 2005-12-14
  • 打赏
  • 举报
回复
TIdHTTP可以
constantine 2005-12-14
  • 打赏
  • 举报
回复
get的断点支持要自己实现
可以用
Request.ContentRangeStart
控制流的位置
constantine 2005-12-14
  • 打赏
  • 举报
回复
用get,put就可以了
get下载,支持断点
put要server端支持,你可以在iis试试,把可写打上钩就可以put了

1,316

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder 网络及通讯开发
社区管理员
  • 网络及通讯开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧