added support for UTF-8
now the UTF-8 is a default charset git-svn-id: svn://ttmath.org/publicrep/winix/trunk@677 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -22,7 +22,7 @@ namespace Fun
|
||||
|
||||
Upload::Upload()
|
||||
{
|
||||
fun.url = "upload";
|
||||
fun.url = L"upload";
|
||||
}
|
||||
|
||||
|
||||
@@ -91,9 +91,9 @@ return true;
|
||||
|
||||
|
||||
|
||||
void Upload::UploadSaveFile(const std::string & tmp_filename, const std::string & destination)
|
||||
void Upload::UploadSaveFile(const std::wstring & tmp_filename, const std::wstring & destination)
|
||||
{
|
||||
if( rename(tmp_filename.c_str(), destination.c_str()) == 0 )
|
||||
if( RenameFile(tmp_filename, destination) )
|
||||
{
|
||||
log << log1 << "Content: uploaded a new file: " << destination << logend;
|
||||
}
|
||||
@@ -149,7 +149,7 @@ void Upload::UploadMulti()
|
||||
|
||||
for( ; i != request->post_file_tab.end() ; ++i)
|
||||
{
|
||||
const char * file_name = i->second.filename.c_str();
|
||||
const wchar_t * file_name = i->second.filename.c_str();
|
||||
|
||||
request->item.subject = file_name;
|
||||
request->item.url = file_name;
|
||||
@@ -174,8 +174,8 @@ void Upload::UploadMulti()
|
||||
|
||||
void Upload::UploadSingle()
|
||||
{
|
||||
const std::string & new_subject = request->PostVar("subject");
|
||||
const std::string & new_url = request->PostVar("url");
|
||||
const std::wstring & new_subject = request->PostVar(L"subject");
|
||||
const std::wstring & new_url = request->PostVar(L"url");
|
||||
bool has_subject = !new_subject.empty();
|
||||
bool has_url = !new_url.empty(); //(new_url && (*new_url)[0] != 0 );
|
||||
|
||||
@@ -183,7 +183,7 @@ void Upload::UploadSingle()
|
||||
functions->SetUser(request->item);
|
||||
request->item.privileges = 0644; // !! tymczasowo
|
||||
|
||||
const char * file_name = request->post_file_tab.begin()->second.filename.c_str();
|
||||
const wchar_t * file_name = request->post_file_tab.begin()->second.filename.c_str();
|
||||
request->item.auth = SelectFileType(file_name);
|
||||
|
||||
if( !has_subject )
|
||||
@@ -203,13 +203,13 @@ void Upload::UploadSingle()
|
||||
|
||||
if( request->status == WINIX_ERR_OK )
|
||||
{
|
||||
const std::string & tmp_filename = request->post_file_tab.begin()->second.tmp_filename;
|
||||
const std::wstring & tmp_filename = request->post_file_tab.begin()->second.tmp_filename;
|
||||
UploadSaveFile(tmp_filename, request->item.auth_path);
|
||||
request->status = db->EditAuthById(request->item, request->item.id);
|
||||
}
|
||||
|
||||
if( request->status == WINIX_ERR_OK )
|
||||
system->RedirectTo(request->item, "/cat");
|
||||
system->RedirectTo(request->item, L"/cat");
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user