SFML community forums
Help => Network => Topic started by: Comme le vent on April 04, 2011, 11:02:18 am
-
Hey guys, hi laurent
i have a small problem: I'm trying to upload an html to a parallels confixx server, but it doesn't work. It is a file that i download, change, and then want to upload again to overwrite it. The download works, but when uploading response.GetStatus() gives 1003, which according to the documentation is invalid file. But i don't understand what it means, the file is not currupt and the program should be able to find it as it is in the directory of the exe. I tried "C:\\file.html" and copied it there but that doesn't help either.
What's the issue?
-
This is definitely a path problem, SFML returns 1003 on upload when the file couldn't be opened.
Try this to make suree that it has nothing to do with SFML or FTP:
#include <fstream>
#include <iostream>
int main()
{
std::ifstream file("whatever/file.html");
if (!file)
std::cout << "error" << std::endl;
return 0;
}
-
i already do this.
std::ifstream in("plan.html");
if(!in.is_open()) { std::cerr << "Error: cannot open ifstream." << std::endl; return; }
The ifstream is ok and the file is copied into a std::string which is parsed & edited and then written to file. The resulting html is displayed correctly offline in firefox and online after manual upload with filezilla. Even if i only download the file without opening and editing it, the upload fails. The ifstream rading the file from c:\\plan.html works as well.
edit: os is vista ultimate, compiler vc++2005 if it matters.
upload is
resp = server.Upload("", "plan.html");
if(!resp.IsOk()) { std::cerr << "\nError " << resp.GetStatus() << ". Failed to upload to server.\n"; }
-
Well, here are the first lines of the Ftp::Upload function:
Ftp::Response Ftp::Upload(const std::string& LocalFile, const std::string& DestPath, TransferMode Mode)
{
// Get the contents of the file to send
std::ifstream File(LocalFile.c_str(), std::ios_base::binary);
if (!File)
return Response(Response::InvalidFile);
And this is the only place where InvalidFile can be returned.
Are you sure that you didn't invert the arguments (must be local file first, then distant path)?
-
Are you sure that you didn't invert the arguments (must be local file first, then distant path)?
jesus christ. I successfully embarassed myself. :roll:
Anyway thanks a lot.