Data Access Worldwide Knowledge Base

Article ID 2271
Article Title HOWTO: HTTP File Transfers
Article URL http://www.dataaccess.com/kbasepublic/KBPrint.asp?ArticleID=2271
KBase Category VDF (GENERAL)
Date Created 11/30/2006
Last Edit Date 11/30/2006


Article Text
VDF supports HTTP file transfers.  Transferring a file using HTTP instead of FTP is useful when files need to be downloaded from a webserver that does not implement FTP for security reasons.

DAC provides the cHTTPTransfer class which also quick creation of a HTTPTransfer object using the Studio.

The minimum to download a file is:

1. Create the HTTPTranfer object form the toolbar.

2. Set the properties.
   a. psRemoteHost  - www.covesys.com
   b. psAcceptTypes - blank (see below)
   c. psSaveasFile    - destination file name

3. Create a button with the OnClick message set to:

Procedure OnClick
  Integer iRetval
   Get HTTPGetRequest of oHttpTransfer  {source file name}  to iRetval
End_Procedure


Issues:

The HTTPTranfer object does a GET from the webserver.  The object and the webserver try to figure out what type file is being transfer which can get messy.  The psAcceptTypes property allows you to restrict the types of files the GET will return, but since you are asking for a particulare file you don't need this.  Leaving it blank will allow you to download any type of file - as long as the webserver knows what type of file it is.

The most common types of files are handled: EXE, PDF, ZIP, OCX...

The below links describe what the Content-Type stuff is all about.


Contributed By:
Frank Valcarcel
Company: Cove Systems, Inc.
email: fv@covesys.com
Web Site: http://www.covesys.com

Web Links Related to this Article
HttpOpenRequest
URL=http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcesdkr/html/_wcesdk_win32_HttpOpenRequest.asp

MIME Type Detection in Internet Explorer
URL=http://msdn.microsoft.com/library/default.asp?url=/workshop/networking/moniker/overview/appendix_a.asp


Email this Article
Email this Article to a Colleague
Send Feedback on this Article to Data Access Worldwide
Copyright ©2010 Data Access Corporation. All rights reserved.

The information provided in the Data Access Technical Knowledge Base is provided "as is" without warranty of any kind. Data Access Corporation disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. In no event shall Data Access Corporation or its suppliers be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages, even if Data Access Corporation or its suppliers have been advised of the possibility of such damages. Some states do not allow the exclusion or limitation of liability for consequential or incidental damages so the foregoing limitation may not apply.