aprelium wrote
Lithorien,
POSTed data comes from the browser and not from the web server. In no way Abyss Web Server changes the data that is POSTed from your browser. Abyss simply forwards to the CGI process the data as it receives it from the client (browser).
Aha. I thought POSTed information was processed by the server and reformatted. Thanks for answering that. :)
aprelium wrote
There is also no 256KB limit. In PHP for example, you can upload files that are larger than that (several MB) with no problem.
By the way, what is the browser you're using to send this file? What are the HTTP headers that are sent to the CGI process?
The browser is Mozilla 1.8a6. The process recieves exactly what you saw below: That quoted text is everything it gets.
aprelium wrote
Having your code could also help us understand the origin of the problem.
By the way, we recommend checking the specification of FILE uploads in
http://www.faqs.org/rfcs/rfc1867.html .
I did read the RFC that you've linked to, and here's the code so you can see what's going on:
int upload()
{
header();
std::string file;
double fsize = atoi(getenv("CONTENT_LENGTH"));
std::getline(std::cin, file, '\n'); // Junk
fsize -= file.size();
std::getline(std::cin, file, '\n'); // Content-Disposition: xxx; xxx; filename=
fsize -= file.size();
std::string filename = "uploads/";
for (int x = (file.find("filename=", 0) + 10); x < (file.size() - 1); x++)
{
filename += file[x];
}
std::getline(std::cin, file, '\n'); // Content-Type: x/x
fsize -= file.size();
std::getline(std::cin, file, '\n'); // Blank
fsize -= file.size();
std::ofstream oFile(filename.c_str(), std::ios::binary);
for (int x = 0; x < (fsize - 61); x++)
{
char *temp = new char;
std::cin.read(temp, 1);
std::cout.write(temp, 1);
//oFile << file;
}
oFile.close();
// Perform error checking for file upload here.
std::cout << "File uploaded successfully to <a href="" << filename << "">" << filename << "</a>";
footer();
return(0);
}