Feature request: Upload temp file and rename to original
Moderator: Project members
Feature request: Upload temp file and rename to original
Hi, I only entered to say that web developers need to upload web files without overwriting any file when uploading, only when completed.
For example if the upload fails, the file in the server will be corrupt, or when you are uploading the file it cant be used, if it is a php file then throws errors to users that are using it.
The solution would be upload a temp file and then rename it. I remember that previous versions of filezilla used this method to upload files.
Wiliam.
For example if the upload fails, the file in the server will be corrupt, or when you are uploading the file it cant be used, if it is a php file then throws errors to users that are using it.
The solution would be upload a temp file and then rename it. I remember that previous versions of filezilla used this method to upload files.
Wiliam.
Re: Feature request: Upload temp file and rename to original
Odd, I wrote FileZilla and don't remember implementing anything like this. Then again, I might be confusing things.I remember that previous versions of filezilla used this method to upload files.
Re: Feature request: Upload temp file and rename to original
Then I confused it, sorry. You understood what I said?botg wrote:Odd, I wrote FileZilla and don't remember implementing anything like this. Then again, I might be confusing things.I remember that previous versions of filezilla used this method to upload files.
Re: Feature request: Upload temp file and rename to original
Yes. Would be hard to implement though as the exact semantics of the RNFR/RNTO command pair are left somewhat unspecified by the FTP standard.
Re: Feature request: Upload temp file and rename to original
But it will be enough for example to do the next automatically:botg wrote:Yes. Would be hard to implement though as the exact semantics of the RNFR/RNTO command pair are left somewhat unspecified by the FTP standard.
Source file to upload: code.php
Existing file in the server: code.php (old one)
STOR .code.php.tmp (first dot to make it invisible)
RNFR .code.php.tmp
RNTO code.php (change old one to new one instantaneously, without corrupting the file when uploading)
I think that I haven't understood what you said about that two ftp commands. Sorry!
Re: Feature request: Upload temp file and rename to original
Certainly possible, but some servers won't like it. On many servers, you can't RNTO a file that exists, so you'd need to DELE the target file first. So an possibly implemented method would only work with full rights on the target directory.
No support requests over PM! You will NOT get any reply!!!
FTP connection problems? Please read Network Configuration.
FileZilla connection test: https://filezilla-project.org/conntest.php
FileZilla Pro support: https://customerforum.fileZilla-project.org
FTP connection problems? Please read Network Configuration.
FileZilla connection test: https://filezilla-project.org/conntest.php
FileZilla Pro support: https://customerforum.fileZilla-project.org
Re: Feature request: Upload temp file and rename to original
In my case it will be ok because the folders have full privileges and RNTO can overwrite. I'm only searching a fast way to hook filezilla and work faster in my webprojects, for example I can try to hook this region of code to upload the file with another name:
[ftpcontrolsocket.cpp - line 2718]
This will upload the file with the name (name + ".tmp")? Sorry if it's incorrect, I haven't used C++ since 5 or 6 years, and wx never.
[ftpcontrolsocket.cpp - line 2718]
Code: Select all
if (pData->download)
cmd = _T("RETR ");
else if (pData->resume)
{
if (CServerCapabilities::GetCapability(*m_pCurrentServer, rest_stream) == yes)
cmd = _T("STOR "); // In this case REST gets sent since resume offset was set earlier
else
{
wxASSERT(pData->resumeOffset == 0);
cmd = _T("APPE ");
}
}
else
cmd = _T("STOR ");
// Hook
if(!pData->download && !pData->resume && pData.remoteFile.Length > 4 && pData.remoteFile.Mid(pData.remoteFile.Length - 4).Lower() == ".php")
cmd += pData->remotePath.FormatFilename(pData->remoteFile + ".tmp", !pData->tryAbsolutePath);
else
cmd += pData->remotePath.FormatFilename(pData->remoteFile, !pData->tryAbsolutePath);
Re: Feature request: Upload temp file and rename to original
Yes, almost. You need to enclose the string literal in _T() though so that it works with the mandatory unicode build of FileZilla.