Advertisement Jump to content
Sign in to follow this  
Weny Sky

Upload file by HTTP POST

This topic is 4888 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi There! I need upload file to the server. I tried to do it by FTP protocol, but if someone disassemble my application, he will see server's psw and user name :(. I heard about sending files to the server by HTTP protocol and his method POST. But I don't know how make it :( I didn't find any tutorial or example. thx for your help with my problem and please excuse my bad english. Weny Sky proud member of BlueA software( )

Share this post

Link to post
Share on other sites
Which part do you need help with? The HTTP protocol for use on the clientside, or how to setup something on the serverside (php,asp,etc) to recieve it?

Share this post

Link to post
Share on other sites
I was faced with a similar problem lately and solved it by using libcurl for the HTTP transfer. The library is really nice and quite easy to use.
Here it an example that POSTs some data:

CURL * Curl = curl_easy_init();
if (Curl)
curl_easy_setopt(Curl, CURLOPT_URL, "");
curl_easy_setopt(Curl, CURLOPT_POST, TRUE);
curl_easy_setopt(Curl, CURLOPT_POSTFIELDS, &Postdata);
curl_easy_setopt(Curl, CURLOPT_POSTFIELDSIZE, sizeof(Postdata));


You can also set some callbacks to keep track of the transfer progress. Just take a look at the documentation.

I haven't dealt with the receiving side so far but it should be no problem to read the POST data on the server-side and write it into a file.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!