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.

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

Guest

Re: FilePermission on Upload file FTP protocol

martin 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

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


This works! Many many thanks.
martin

Re: FilePermission on Upload file FTP protocol

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

You might be able to use Session.ExecuteCommand("SITE CHMOD 777 /tmp/patch.tgz")
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.
martin

Re: FilePermission on Upload file FTP protocol

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.
calatubo

FilePermission on Upload file FTP protocol

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)