Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

dataflow

Re: Upload files works in FileZilla not WinSCP

Just a quick followup: I had suspected the issue was a server problem, and it was. I used the exact same installation of WinSCP (no changes to it) and the same file I as having trouble uploading with SFTPv6 earlier, tried to upload it on Tuesday (yesterday) with SFTPv6, and it worked. I suspect they restarted the server.

However, the hack I posted earlier (switching to SFTPv3), may come in handy if another user encounters the same issue I encountered.
martin

Re: Upload files works in FileZilla not WinSCP

@dataflow: Thanks. I've sent you an email.
dataflow

Re: Upload files works in FileZilla not WinSCP

@martin: I was able to reproduce the issue after I shutdown and restarted my PC.
I generated two log files from a Debug 2 level session:

  • one with SFTP version set to 6, and upload failed. Size is about 442 MB.
  • one with SFTP version set to 3, and upload succeeded. Size is about 442 MB.

I have redacted the files to the best of my ability. Is there a way I can get these files to you privately? Like an SFTP site or some such? Feel free to email. Please let me know.
martin

Re: Upload files works in FileZilla not WinSCP

@dataflow: Thanks for sharing your findings.
Can you post Debug 2 level session log file?
dataflow

Re: Upload files works in FileZilla not WinSCP

I have tried adjusting the settings every way possible but either got the same error or a worse error. I ultimately want to upload using PowerShell and WinSCP but need it to work in the GUI first.

I encountered this exact baffling error today but solved it. It was the SFTP protocol version that was the problem. WinSCP defaults to 6 (I even downloaded the latest version today of WinSCP). FileZilla defaults to 3. When I set WinSCP to SFTP protocol version 3, the file upload executed successfully.

I suppose an incorrect implementation of version six at either the server or client (or both) is the root cause.
martin

Re: Upload files works in FileZilla not WinSCP

Your code looks good. If it does not work, please post complete log file.
kul2bme

Re: Upload files works in FileZilla not WinSCP

I finally found a settings combination in the GUI that worked without the error. I have attached the edited for privacy log file. I would like to take those and covert them to the settings that would work for a PowerShell script to try to duplicate what the GUI is doing. Below is the PS scripting that I have thus far but it does not work and I am not sure how to convey the log file settings to PS settings ... Any help would be greatly appreciated.

# Load WinSCP .NET assembly
Add-Type -Path "C:\Program Files (x86)\WinSCP\WinSCPnet.dll";
 
#pass the new file to secure FTP
# Setup session options
$sessionOptions = New-Object WinSCP.SessionOptions -Property @{
    Protocol = [WinSCP.Protocol]::Sftp
    HostName = "HOSTNAME"
    UserName = "USERNAME"
    Password = 'PASSWORD'
    SshHostKeyFingerprint = "ssh-dss 1024 EDITED FOR PRIVACY"
    Timeout = 600
}
 
$session = New-Object WinSCP.Session;
try
{
    #$tim = Get-Date -Format HH:mm:ss
    #Write-Host "Connecting ...  " $tim
    $session.SessionLogPath = 'LOGPATH\winscp.log';
 
    ## Connect
    $session.Open($sessionOptions);
   
    $transferOptions = New-Object WinSCP.TransferOptions
    $transferOptions.ResumeSupport.State = [WinSCP.TransferResumeSupportState]::Off
    $transferOptions.FilePermissions = $Null # This is default
    $transferOptions.PreserveTimestamp = $False
    $transferOptions.TransferMode = [WinSCP.TransferMode]::Binary
    $transferOptions.FileMask = '*.*';
   
    ## copy file to SFTP
    $transferResult = $session.PutFiles($file270,$remotePath,$False,$transferOptions);
 
    $transferResult.Check();
   
    ##close connection
    $Session.Close()
}
finally
{
    # Disconnect, clean up
    $session.Dispose();
}
kul2bme

Re: Upload files works in FileZilla not WinSCP

Here is the log file for my attempt to do "---------" and "Ignore permission errors" as well as default permissions "rwxrwxrwx" (which is what is shown on server side) and "Ignore permission errors". I still get the popup with the error message but the file does copy over.

I do not think that I stated that aspect before that the file does copy and is usable from the GUI side the DLL side the file gets cutoff at 65535 bytes and is unusable.
kul2bme

Re: Upload files works in FileZilla not WinSCP

I have tried "turn off setting permissions or preserving timestamp. Alternatively you can turn on ‘Ignore permission errors’ option." in the WinSCP app and still got the error popup screen that told me the same. I have tried adjusting permissions to all configurations except "---------" (is that turning off permissions). I thought once I figured out how to import the FileZilla settings that worked, that would be my solution. Mind you I have used WinSCP successfully with even default settings on other SFTP connections with no issue. This one is just giving me a fit and their support referred me back to their documentation which has no detail whatsoever just the basics URL, Port, username and password.
martin

Re: Upload files works in FileZilla not WinSCP

"I have tried adjusting the settings every way possible" does not really tell us what did you try.
So I can only point you to:
Upload of file .. was successful, but error occurred while setting the permissions and/or timestamp. If the problem persists, turn off setting permissions or preserving timestamp. Alternatively you can turn on ‘Ignore permission errors’ option.
If it does not help, please tell us what did you try and post corresponding session log file.
kul2bme

Upload files works in FileZilla not WinSCP

I used FileZilla to upload a file to an SFTP site. Everything worked fine. I saved the settings to the Site Manager. I then opened WinSCP and imported the settings from FileZilla. When I tried upload another file in WinSCP with those settings I got the following error ...
Upload of file '63e31c9b-4b63-4ca0-b070-54e028a18444.txt' was successful, but error occurred while setting the permissions and/or timestamp.
If the problem persists, turn off setting permissions or preserving timestamp. Alternatively you can turn on 'Ignore permission errors' option. ("The server does not support the operation.
Error code: 8
Error message from server (en): Operation unsupported")

I have tried adjusting the settings every way possible but either got the same error or a worse error. I ultimately want to upload using PowerShell and WinSCP but need it to work in the GUI first.

I am attaching the logs from FileZilla and WinSCP for review.