Topic "FilePermission on Upload file FTP protocol"

Author Message
calatubo
[View user's profile]

Joined: 2015-02-24
Posts: 8
Hi, sorry for trouble, I'm trying to upload a file with the follow routine ad the file permission are not set as I want.
Can somebody help me to understand where is the mistake? (The permission on the file are the default, as when I not set any file permission). Thanks.

Dim myFilePermission As New FilePermissions
myFilePermission.UserExecute = True
myFilePermission.UserRead = True
myFilePermission.UserWrite = True
myFilePermission.OtherExecute = True
myFilePermission.OtherRead = True
myFilePermission.OtherWrite = True
myFilePermission.GroupExecute = True
myFilePermission.GroupRead = True
myFilePermission.GroupWrite = True
Dim myTransferOptions As New TransferOptions()
myTransferOptions.TransferMode = TransferMode.Binary
myTransferOptions.FilePermissions = myFilePermission
Using mySession As Session = New Session
mySession.Open(mySessionOptions)
If (mySession.FileExists(remotePath + remoteFile)) Then
Dim day As String = Format(Now(), "dd_MM_yyyy") + "_"
l.WriteLine("Rename of " + remotePath + remoteFile + " to " + remotePath + day + remoteFile, clsLogger.sign._INFO)
mySession.MoveFile(remotePath + remoteFile, remotePath + day + remoteFile)
End If
Dim transferResult As TransferOperationResult
transferResult = mySession.PutFiles(local, remotePath + remoteFile, False, myTransferOptions)
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
Your code looks correct.

Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate log file, set Session.SessionLogPath. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.
_________________
Martin Prikryl
Guest




Here the log. I've uploaded a file called Patch.tgz using the routine above. But the file on the target has not the correct privileges, Thanks.
WinSCPLog.log (7.33 KB) [Download]

Description: (none)

martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
I overlooked that you are using FTP protocol.
Setting permissions of uploaded files is not supported with FTP.
https://winscp.net/eng/docs/ui_transfer_custom#upload_options

You might be able to use Session.ExecuteCommand("SITE CHMOD 777 /tmp/patch.tgz")
Guest




prikryl wrote:
I overlooked that you are using FTP protocol.
Setting permissions of uploaded files is not supported with FTP.
https://winscp.net/eng/docs/ui_transfer_custom#upload_options

You might be able to use Session.ExecuteCommand("SITE CHMOD 777 /tmp/patch.tgz")


This works! Many many thanks.
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