Home » U++ Library support » U++ MT-multithreading and servers » HttpRequest File Upload
Re: HttpRequest File Upload [message #39568 is a reply to message #39566] |
Sat, 30 March 2013 12:13 |
|
mirek
Messages: 13984 Registered: November 2005
|
Ultimate Member |
|
|
Brat wrote on Sat, 30 March 2013 06:50 | 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?
|
I guess it this is really service specific, anyway I would dare to say that alternative to passing filename parameter would be "RESTfull" - pass it as part of url. Perhaps something like
HttpRequest req(session[1] + '/' + filename);
Anyway, once again, there is not firm standard...
Mirek
|
|
|
|
|
HttpRequest File Upload
By: Brat on Fri, 29 March 2013 13:23
|
|
|
Re: HttpRequest File Upload
By: Brat on Sat, 30 March 2013 11:50
|
|
|
Re: HttpRequest File Upload
By: mirek on Sat, 30 March 2013 12:13
|
|
|
Re: HttpRequest File Upload
By: Brat on Sat, 30 March 2013 12:44
|
|
|
Re: HttpRequest File Upload
By: mirek on Sat, 30 March 2013 12:51
|
|
|
Re: HttpRequest File Upload
By: Brat on Sat, 30 March 2013 21:11
|
|
|
Re: HttpRequest File Upload
By: mirek on Sun, 31 March 2013 11:48
|
|
|
Re: HttpRequest File Upload
By: Brat on Sun, 31 March 2013 20:41
|
|
|
Re: HttpRequest File Upload
By: mirek on Sat, 06 April 2013 10:05
|
|
|
Re: HttpRequest File Upload
By: mirek on Sat, 29 June 2013 20:53
|
|
|
Re: HttpRequest File Upload
By: Zbych on Mon, 14 October 2013 15:51
|
|
|
Re: HttpRequest File Upload
By: mirek on Mon, 14 October 2013 16:00
|
|
|
Re: HttpRequest File Upload
By: Zbych on Mon, 14 October 2013 16:47
|
|
|
Re: HttpRequest File Upload
By: mirek on Tue, 15 October 2013 07:44
|
|
|
Re: HttpRequest File Upload
By: forlano on Thu, 08 May 2014 14:35
|
|
|
Re: HttpRequest File Upload
By: forlano on Sun, 11 May 2014 22:17
|
Goto Forum:
Current Time: Tue Jun 04 23:53:20 CEST 2024
Total time taken to generate the page: 0.02144 seconds
|