Topic: Displaying attachments corrupted

When I am in the attachments screen and click on either the download button or the view button, a pop-up opens, but the attachment isn't displayed.

trial and error in attachments.php around line 37, replacing the following:

                        $type = ($row['filetype']) ? $row['filetype'] : 'application/octet-stream';
                        header("Content-type: ".$type);
                        header('Content-Length: '.$row['filesize']);
                        header("Content-Disposition: inline");
                        echo file_get_contents(company_path(). "/attachments/".$row['unique_name']);
                exit();


with

                      header( "location: " . $_SERVER['PHP_SELF'] . "/../" . company_path(). "/attachments/".$row['unique_name'] );
                exit();

works.  I don't see any security issue by passing a URL instead of a stream?

Re: Displaying attachments corrupted

I should have mentioned that the files on the server are not corrupted; manually downloading them via SMB and adding the appropriate extension (jpg/png/pdf) makes the files viewable.