Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

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)


Topic review

It worked!

Thanks for your help Martin! The content-type was set when I turned off the suggested settings!

Thanks. After some tests, it seems that the SSH_FXP_SETSTAT SFTP request clears the content type on Azure. It seems like a bug in Azure SFTP.

WinSCP uses that request to update the timestamp and/or permissions of the uploaded file.
So either something has changed on Azure side recently, or you had the "Preserve timestamp" (and "Set permissions") turned off before and now you have either of them on.

Turn both off. Or talk to Azure support.

Thanks for your answer Martin!
As I understand, the Azure Storage SFTP interface defaults content-type to application/octet-stream, and earlier the files we uploaded using WinSCP got the default-content-type but not anymore.

I wrote a C# console app using the Renci.SshNet-package, and when uploading files through this app, the content type was set to the default content type.

Attaching images of blob-properties using WinSCP and Renci.
using Renci.SshNet;
using System;
var host = "";
var port = 22;
var username = "xxxx";
var password = "yyyy";
using var client = new SftpClient(host, port, username, password);
var filePath = @"C:\file.xml";
FileStream fs = new(filePath, FileMode.Open);
client.UploadFile(fs, $"{Path.GetFileName(filePath)}");

Re: Content-type not set when uploading file to Azure Storage

There's no Content-Type involved in SFTP protocol.
If you want to set the Content-Type, you have to use a different interface.

Content-type not set when uploading file to Azure Storage


We use WinSCP to upload files to an SFTP-enabled Azure Storage Account.
We then use BizTalk to further process the file, but the BizTalk-adapter we use to get the file from the storage require the Content-Type to be set.

When we upload the file using WinSCP, this property is not set. I have tried different transfer modes, but it doesn't make any difference.

I also tried to upgrade to 6.3.3 and I have tried to look in the documentation with no success. Do you have any idea how to solve this?

Best regards,