TCPIP.HTTP_PUT_FILE

The TCPIP.HTTP_PUT_FILE("url","header","file_to_read")
function creates a new thread. Thread posts data to a WWW server (POST):
When thread to terminate, it will cause your callback function WM_PUTFILE(ThreadId, error).

  1. You can use the HTTPS resource. https://...
  2. You can use the basic authentication for WWW pages. Set username/password in URL (protocol://username:password@hostname/path_to_file), otherwise you must fill the dialog form.
  3. When thread to terminate, it will cause your function WM_PUTFILE(ThreadId, error) from script (your callback function). You can see the error codes (~HTTP_STATUS_OK == 200), and standard system error code (for file operations).
  4. Return value: If the function succeeds, the return value is a ThreadId to the new thread. If the function fails, the return value is 0.
Here's an example:
// File: http_put.w_js (JScript)
var your_cgi = "http://www.www.www/your_cgi.cgi";
var header = "";
var from_file = "c:\\1.txt";

Window.AppendMenu(0,"MF_STRING",100,"Put file");
Window.DrawMenuBar();


function WM_COMMAND(id) {
if (id == 100) {
    var ThreadId = TCPIP.HTTP_PUT_FILE(your_cgi, header, from_file);
    Window.MessageBox("Trace","ThreadId: " + ThreadId, 64);
};
};

function WM_PUTFILE(ThreadId, error)
{Window.Delete(1);
 Window.TextOut(1,50,50,"ThreadId: " + ThreadId);
 Window.TextOut(1,50,70,"error: " + error);
 Window.UpdateWindow();
};
'VBScript http_put.w_vbs
your_cgi = "http://www.www.www/your_cgi.cgi"
header = ""
from_file = "c:\1.txt"

Window.AppendMenu 0,"MF_STRING",100,"Put file"
Window.DrawMenuBar

Function WM_COMMAND(id) 
If (id = 100) Then
    ThreadId = TCPIP.HTTP_PUT_FILE(your_cgi, header, from_file)
    Window.MessageBox "Trace","ThreadId: " & ThreadId, 64
End If
End Function

Function WM_PUTFILE(ThreadId, err)
 Window.Delete(1)
 Window.TextOut 1,50,50,"ThreadId: " & ThreadId
 Window.TextOut 1,50,70,"error: " & error
 Window.UpdateWindow
End Function
content
The new scripting host. It is not wscript.exe!
JScript and VBScript are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries.