Skip to content

archtim/HttpPostFile

Repository files navigation

HttpPostFile

This simple Visual C++ console program sends a binary file (e.g. jpg) to a REST endpoint. The code defines two structures, FileCloser and InetCloser, which are used to close file handles and internet handles respectively when they are no longer needed. The code also defines two functions, WCharToChar and WriteToInternet, which are used to convert wide-character strings to multibyte strings and write data to an internet handle respectively³. Finally, the code defines a function called PostFile which takes four parameters: a pointer to a null-terminated string that specifies the file name of the file to be uploaded, a pointer to a null-terminated string that specifies the server name or IP address of the server that will receive the file, an integer that specifies the port number of the server, and a pointer to a null-terminated string that specifies the route on the server where the file will be uploaded.

The code includes a simple Python Flask endpoint that can be used for testing the code.

About

Simple Visual C++ console program that sends a binary file to a REST endpoint.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors