Sign in to follow this  

Upload file by HTTP POST

This topic is 4519 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( www.blueasoftware.com )

Share this post


Link to post
Share on other sites
Off topic:

Cool web site! I actually understood it!

I'm originally from Slovakia and it's nice to see more czech/slovak users here! :)

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, "http://www.yoursite.com/");
curl_easy_setopt(Curl, CURLOPT_POST, TRUE);
curl_easy_setopt(Curl, CURLOPT_POSTFIELDS, &Postdata);
curl_easy_setopt(Curl, CURLOPT_POSTFIELDSIZE, sizeof(Postdata));

curl_easy_perform(Curl);
curl_easy_cleanup(Curl);
}


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

This topic is 4519 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this