Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsLinksLinksPDFs Do Not Open In BrowserPDFs Do Not Open In Browser
Previous
 
Next
New Post
6/11/2007 12:33 PM
 

Since this is an issue with a core user control and outside the control of this module, you can consider this THE solution. If the core team investigates the issue further and finds a solution, then there hopefully will be no need for this solution anymore.

 
New Post
6/13/2007 8:53 AM
 

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

 
New Post
6/19/2007 11:00 AM
 

I downloaded the latest Acrobat Reader 8.0 and it now displays PDFs from DNN.

 
New Post
6/19/2007 4:28 PM
 

kmideas wrote

I downloaded the latest Acrobat Reader 8.0 and it now displays PDFs from DNN.

 

Error occurs only if size stored in database is not equal real size of file. So version of Acrobat Reader is not significant.

 
New Post
6/19/2007 7:06 PM
 

All I know is that I can view PDFs whereas I couldn't before.

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsLinksLinksPDFs Do Not Open In BrowserPDFs Do Not Open In Browser


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out