Home » U++ Library support » U++ MT-multithreading and servers » HttpRequest File Upload
Re: HttpRequest File Upload [message #43117 is a reply to message #40184] |
Thu, 08 May 2014 14:35 |
|
forlano
Messages: 1185 Registered: March 2006 Location: Italy
|
Senior Contributor |
|
|
Hello,
I am resuming this old post.
I am having problem with the upload file.
This a working PHP file (tested by browser via a html file driver) located in /var/www/vega/logup
<?php
//transfer.php
function Upload($folder)
{ $target = "./". basename( $_FILES['file']['name']) ;
echo $target;
if(copy($_FILES['file']['tmp_name'], $target)) return 1;
else return 0;
}
Upload("");
?>
It saves the file in the same folder. This is the U++ driver program:
void PublishSiteDlg::PublishVega()
{ String fn = TD.PATHDIRWWW+"compress.zip";
if (FileExists(fn)) DeleteFile(fn);
FileZip zip(fn);
String targetdir = TD.PATHDIRWWW;
FindFile fff(AppendFileName(targetdir, "*.*"));
while(fff) {
if(fff.IsFile()) {
zip.WriteFile(LoadFile(TD.PATHDIRWWW+fff.GetName()), fff.GetName());
}
fff.Next();
}
zip.Finish(); //all OK here and the file is created
HttpRequest req("http://localhost/vega/logup/transfer.php");
req.POST();
req.Part("file", LoadFile(fn), "application/zip", fn);
req.Post("submit", "submit");
String s = req.Execute();
Exclamation(s);
}
The previous code shows the echoed file name but no file is uploaded.
What I am missing?
Thanks,
Luigi
|
|
|
|
|
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: Thu May 16 06:16:50 CEST 2024
Total time taken to generate the page: 0.02905 seconds
|