Problem is in DNN core. You can to use 2 ways to resolve it:
1. Enable File AutoSync feature in DNN
2. Change method DownloadFile(ByVal PortalId As Integer, ByVal FileId As Integer, ByVal ClientCache As Boolean, ByVal ForceDownload As Boolean) in FileSystemUtils.vb to following:
Public Shared Function DownloadFile(ByVal PortalId As Integer, ByVal FileId As Integer, ByVal ClientCache As Boolean, ByVal ForceDownload As Boolean) As Boolean
Dim blnDownload As Boolean = False
' get file
Dim objFiles As New FileController
Dim objFile As DotNetNuke.Services.FileSystem.FileInfo = objFiles.GetFileById(FileId, PortalId)
Dim strFile As String = ""
Select Case objFile.StorageLocation
Case FolderController.StorageLocationTypes.InsecureFileSystem
strFile = objFile.PhysicalPath
Case FolderController.StorageLocationTypes.SecureFileSystem
strFile = objFile.PhysicalPath & glbProtectedExtension
End Select
Dim objFileInfo As System.IO.FileInfo = New System.IO.FileInfo(strFile)
If Not objFile Is Nothing Then
' check folder view permissions
If PortalSecurity.IsInRoles(FileSystemUtils.GetRoles(objFile.Folder, PortalId, "READ")) Then
' auto sync
Dim blnFileExists As Boolean = True
If DotNetNuke.Entities.Host.HostSettings.GetHostSetting("EnableFileAutoSync") <> "N" Then
If strFile <> "" Then
' synchronize file
If objFileInfo.Exists Then
If objFile.Size <> objFileInfo.Length Then
objFile.Size = CType(objFileInfo.Length, Integer)
UpdateFileData(FileId, objFile.FolderId, PortalId, objFile.FileName, objFile.Extension, GetContentType(objFile.Extension), objFileInfo.Length, objFile.Folder)
End If
Else ' file does not exist
RemoveOrphanedFile(objFile, PortalId)
blnFileExists = False
End If
End If
End If
' download file
If blnFileExists Then
' save script timeout
Dim scriptTimeOut As Integer = HttpContext.Current.Server.ScriptTimeout
' temporarily set script timeout to large value ( this value is only applicable when application is not running in Debug mode )
HttpContext.Current.Server.ScriptTimeout = Integer.MaxValue
Dim objResponse As HttpResponse = HttpContext.Current.Response
objResponse.ClearContent()
objResponse.ClearHeaders()
' force download dialog
If ForceDownload Then
objResponse.AppendHeader("content-disposition", "attachment; filename=""" + objFile.FileName + """")
Else
'use proper file name when browser forces download because of file type (save as name should match file name)
objResponse.AppendHeader("content-disposition", "inline; filename=""" + objFile.FileName + """")
End If
objResponse.AppendHeader("Content-Length", objFileInfo.Length.ToString())
objResponse.ContentType = GetContentType(objFile.Extension.Replace(".", ""))
'Stream the file to the response
Dim objStream As IO.Stream = FileSystemUtils.GetFileStream(objFile)
Try
WriteStream(objResponse, objStream)
Catch ex As Exception
' Trap the error, if any.
objResponse.Write("Error : " & ex.Message)
Finally
If IsNothing(objStream) = False Then
' Close the file.
objStream.Close()
End If
End Try
objResponse.Flush()
objResponse.End()
' reset script timeout
HttpContext.Current.Server.ScriptTimeout = scriptTimeOut
blnDownload = True
End If
End If
End If
Return blnDownload
End Function
I'm sorry if there are problems in my code. I'm not VB guru