Topic "Rename file during upload"

Author Message
lee_r

Guest


Situation:
You upload a 100 KB PHP/Python/Ruby/whatever file to your webserver.
During the upload (especially on slow lines) the file can possibly be retrieved partially because parsing doesn't work yet.
Just imagine the login data to your database can be seen in clear text in the browser of someone accidentally loading a website while you upload it.
This also affects editing and saving a file in WinSCP.

Solution:
Option for uploading the file renamed like $FILENAME_temp$threerandomchars and automatic renaming to the original filename when uploading is finished.
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24991
Location: Prague, Czechia
If you use SFTP protocol, you may enable transfer resuming for all files, which results in behaviour you describe.
_________________
Martin Prikryl
lee_r

Guest


Thanks for the hint, but this doesn't seem to work when you want to overwrite existing files, only when uploading new files.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24991
Location: Prague, Czechia
lee_r wrote:
Thanks for the hint, but this doesn't seem to work when you want to overwrite existing files, only when uploading new files.

I do not think so. What does happen if you are overtwritting the existing files?
_________________
Martin Prikryl
lee_r

Guest


I was able to nail down the circumstances under which the problem happens:
in binary transfer mode both uploading and overwriting is done correctly using $FILENAME.filepart.
I've tested this with an EXE and a ZIP file -> both fine, because it's binary transfer.

Then I tried the same using a 2 MB TXT file and a 150 KB PHP file (text mode transfer)
Both were uploaded using the filename without the temporary filepart extension.
The same goes for overwriting, the previous file is just being deleted and then the upload starts using $FILENAME.

Looks like a bug when using text transfer mode.
If it helps I'm using WinSCP 3.8.2 (Build 330).
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24991
Location: Prague, Czechia
lee_r wrote:
Then I tried the same using a 2 MB TXT file and a 150 KB PHP file (text mode transfer)
Both were uploaded using the filename without the temporary filepart extension.
The same goes for overwriting, the previous file is just being deleted and then the upload starts using $FILENAME.

Looks like a bug when using text transfer mode.
If it helps I'm using WinSCP 3.8.2 (Build 330).

Resuming is not supported for text transfer mode. You may need to force binary mode.
_________________
Martin Prikryl
Guest




prikryl wrote:
Resuming is not supported for text transfer mode. You may need to force binary mode.

Agreed, but resuming isn't what's needed, it would just be great that $FILENAME is being uploaded as $FILENAME.filepart and renamed to $FILENAME when uploading has finished.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24991
Location: Prague, Czechia
Quote:
Agreed, but resuming isn't what's needed, it would just be great that $FILENAME is being uploaded as $FILENAME.filepart and renamed to $FILENAME when uploading has finished.

I understand your problem. Maybe if more people ask for it, I'll consider adding such a feature.
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License