Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ MT-multithreading and servers » HttpRequest File Upload
HttpRequest File Upload [message #39557] Fri, 29 March 2013 13:23 Go to previous message
Brat is currently offline  Brat
Messages: 7
Registered: March 2013
Promising Member
Hello,
i want to upload an file to Rapidshare with HttpRequest.
Is there an example how to create a POST Request? And an example how to upload a file?
I found this code, but i dont whether it works or not and how to add other post parameters (like username, password)
	String boundary = "BbX8c0";
	StringBuffer b;
	b.Cat("--" + boundary + "\r\n");
	b.Cat("Content-Disposition: form-data; name=\"file\"; filename=\"" + file + "\"\r\n\r\n");
	b.Cat(fi);
	b.Cat("\r\n--" + boundary + "--\r\n");


//EDIT: Okay, now i know what was wrong. Right code is

	HttpRequest GetServer("http://api.rapidshare.com/cgi-bin/rsapi.cgi?sub=nextuploadserver");
	ulserver = GetServer.Execute();
	if(!GetServer.IsSuccess()){
		PromptOK("Couldn find uploadserver");
		return;
	}


	HttpRequest req("http://rs" + ulserver + ".rapidshare.com/cgi-bin/rsapi.cgi");
	req.POST();
	req.Post("sub", "upload");
	req.Post("login", "NAME");
	req.Post("password", "PASSWORD");
	req.Post("filename", file);
	req.Post("filecontent", LoadFile(file));
	String s = req.Execute();

[Updated on: Fri, 29 March 2013 14:49]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to use Skylark on external server
Next Topic: [SOLVED] Fix some memory leak in IpAddrInfo
Goto Forum:
  


Current Time: Mon Apr 29 18:20:25 CEST 2024

Total time taken to generate the page: 0.02230 seconds