This function transfers a file to the HTTP server or the HTTPS.

[C++Builder/Visual C++]     BOOL IKHTTPPutFileEx(HINTERNET hConnect, LPCTSTR RemoteFile, LPCTSTR LocalFile, long TransPercent, IKPROCESSPROC UserProc);
[Delphi]         function IKHTTPPutFileEx(hConnect: HINTERNET; RemoteFile, LocalFile: LPCTSTR; TransPercent: Longint; UserProc: Longint): LongBool;
[Visual Basic]   Function IKHTTPPutFileEx(ByVal hConnect As Long, ByVal RemoteFile As String, ByVal LocalFile As String, ByVal TransPercent As Long, ByVal UserProc As Long) As Long

Parameters

Name Explanation
hConnect The session handle retrieved from the IKFTPConnect function
RemoteFile The destination on the HTTP(S) server where the file is to be saved. Includes path and file name
LocalFile The filename and path of the local file to be transferred
UserName The username needed to access the HTTP(S) server
Password The password needed to access the HTTP(S) server
TransPercent The percent of file tranferred before the User Function is called
UserProc The address of the user function (If not using the user function then set to 0)

Return Value

Returns True (nonzero) if successful. Returns False (0) if unsuccessful.

Explanation

The IKHTTPPutFileEx function transfers a file to the HTTP server or the HTTPS server. It can be used only after the IKHTTPConnect function has successfully connected to the HTTP(S) server. This method can only be executed from the client computer. It does not operate on the server. The TransPercent parameter sets the percent of file tranferred before the User Function is called.

Example Code:

(1) C++Builder/Visual C++
HINTERNET hOpen, hConnect;
if (IKHTTPConnect("www.newtone.co.jp", "User", "Password", &hOpen, &hConnect) == FALSE) return;
IKHTTPPutFileEx(hConnect, "images/001.jpg", "C:\\Images\\001.jpg", 10, 0);
IKHTTPDisconnect(hOpen, hConnect);

(2) Delphi
hOpen, hConnect: HINTERNET;
if (IKHTTPConnect('www.newtone.co.jp', 'User', 'Password', @hOpen, @hConnect) = False) then Exit;
IKHTTPPutFileEx(hConnect, 'images/001.jpg', 'C:\Images\001.jpg', 10, 0);
IKHTTPDisconnect(hOpen, hConnect);

(3) Visual Basic
Dim hOpen As Long
Dim hConnect As Long
If IKHTTPConnect("www.newtone.co.jp", "User", "Password", hOpen, hConnect) = False Then Exit Sub
Call IKHTTPPutFileEx(hConnect, "images/001.jpg", 'C:\Images\001.jpg', 10, 0)
Call IKHTTPDisconnect(hOpen, hConnect)

 

The ImageKit10 ActiveX is a product created by Newtone Corporation