I ran into an issue where an FTP user could not access files uploaded from a radasyncupload control. The user had permissions to the target directory. Files added to the directory inherited the permissions of the directory when except when uploaded asynchronously.
Here’s what I found. In a part of my application I’m Telerik RadFileUpload instead of the standard asp file upload control.
Because Telerik RadFileupload is asynchronous, it first uploads the file to a temporary directory (/RadUploadTemp). Once fully
uploaded, it then automatically moves it to the target directory (/TargetDirectory/…)
Here is the problem. As the file is being moved it takes the permissions associated the temporary directory with it. Since the fpt account had no permissions in the RadUploadTemp directory, it assigns no permissions to the file when moved to the TargetDirectory .
In order to resolve this, I gave read permissions the ftp account in the RadUploadTemp directory and now it copies the files with the permissions.
While the link below does not address the rad control specifically, it lead me to the answer. In my case, I had to apply permissions to the temp directory.
http://stackoverflow.com/questions/23136723/why-are-permissions-wonky-when-my-iis-worker-saves-a-file-in-asp-net
Is this something Tererik could fix in a way similarly stated in the article?:
"I suspect the problem is with the use of Path.GetTempFileName followed by File.Move. When the uploaded file is saved to tempFilename, the temporary file gets whatever permissions are assigned to the temporary folder. Moving the file preserves those permissions as is instead of recalculating the inheritable permissions based on the destination.Instead of File.Move, try using File.Copy"
Hope this helps somebody else.
Here’s what I found. In a part of my application I’m Telerik RadFileUpload instead of the standard asp file upload control.
Because Telerik RadFileupload is asynchronous, it first uploads the file to a temporary directory (/RadUploadTemp). Once fully
uploaded, it then automatically moves it to the target directory (/TargetDirectory/…)
Here is the problem. As the file is being moved it takes the permissions associated the temporary directory with it. Since the fpt account had no permissions in the RadUploadTemp directory, it assigns no permissions to the file when moved to the TargetDirectory .
In order to resolve this, I gave read permissions the ftp account in the RadUploadTemp directory and now it copies the files with the permissions.
While the link below does not address the rad control specifically, it lead me to the answer. In my case, I had to apply permissions to the temp directory.
http://stackoverflow.com/questions/23136723/why-are-permissions-wonky-when-my-iis-worker-saves-a-file-in-asp-net
Is this something Tererik could fix in a way similarly stated in the article?:
"I suspect the problem is with the use of Path.GetTempFileName followed by File.Move. When the uploaded file is saved to tempFilename, the temporary file gets whatever permissions are assigned to the temporary folder. Moving the file preserves those permissions as is instead of recalculating the inheritable permissions based on the destination.Instead of File.Move, try using File.Copy"
Hope this helps somebody else.