U++ framework
Do not panic. Ask here before giving up.

Home » U++ Library support » U++ MT-multithreading and servers » HttpRequest File Upload
Re: HttpRequest File Upload [message #39566 is a reply to message #39557] Sat, 30 March 2013 11:50 Go to previous messageGo to previous message
Brat is currently offline  Brat
Messages: 7
Registered: March 2013
Promising Member
Okay,
seems like the code only works because the Rapidshare API allows to override the filename with the "filname" parameter.
When I wand to upload a file to share-online.biz, i cant pass the filename as an parameter.

void fUpload::Upload(){
	Vector <String> session; // to store SESSION and ServerURL
	int64 Filesize;
	String ret;
	FileIn fi;
	if(file == ""){
		PromptOK("No File selected");
		return;
	}

	HttpRequest GetServer("http://www.share-online.biz/upv3_session.php");
	GetServer.POST();
	GetServer.Post("username", "USER");
	GetServer.Post("password", "PW");
	ret = GetServer.Execute();
	if(!GetServer.IsSuccess()){
		PromptOK("Couldnt find uploadserver");
		return;
	}
	session = Split(ret, ";");
	if(!fi.Open(file)){
		PromptOK("Couldnt open " + file);
		return;
	}
	Filesize = fi.GetSize();
	fi.Close();

	HttpRequest	req(session[1]);
	req.POST();
	req.Post("username", "USER");
	req.Post("password", "PW");
	req.Post("upload_session", session[0]);
	req.Post("chunk_no", "1");
	req.Post("chunk_number", "1");
	req.Post("filesize", AsString(Filesize));
	req.Post("fn", LoadFile(file));
	req.Post("finalize", "1");
	ret = req.Execute();
	if(!req.IsSuccess()){
		PromptOK("FAILED");
		PromptOK(req.GetErrorDesc());
		return;
	}
	
	PromptOK(ret);
}

The second request doesnt work cause there is no filename parameter. How can i pass the filename without a filename parameter?
 
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: Thu Jun 18 21:45:07 GMT+2 2026

Total time taken to generate the page: 0.00629 seconds