XF 1.5 Attachments can't be downloaded


Active member
It appears that with some browsers/systems that attachments can't be downloaded, in particular I'm trying PDFs.

I think I've narrowed this down to mobile and suspect that the attachment URLs are being handed over to the system or PDF viewer for download, and then of course they don't have permission to get it so the download fails. I assume even of desktop though, if there is some kind of download manager in use the same problem will occur.

Testing on my desktop with Firefox and Adobe Reader it works fine but testing on Android with Chrome it fails. Desktop Firefox will download the file first, then open it in Reader.

On my forum I have some attachments in restricted forums, but even those in the general forum don't download. The only way I can find to allow attachments to always work is to allow the Unregistered/Unconfirmed usergroup to 'view attachments to posts'.

Is there any other solution to this? Would changing over to XSendfile to hand-off the downloads to Apache rather than PHP help, or am I going to hit the same roadblock?

Jake Bunce

XenForo moderator
Staff member
Can't download or can't open? If you don't have a reader then it's possible to download the file but not be able to open it.

The guest permission is not intuitive to me unless the user is somehow being logged out in the process. Is the user logged in when downloading the attachment?


Active member
I have a PDF reader installed. User is logged in, I've also tried as a guest.

If I long press and 'save link' that works fine, I can then go and open it.

If I just click the PDF attachment link it seems to hand off the downloading to maybe the PDF viewer app instead which then hangs and fails. So, I'm suspecting that the app obviously is not logged into the XF and therefore has no permissions to download the file. If there was a way to force download rather than allow it to be directly opened it might help this.

However playing around again today with Android and Chrome, I can't even get it working on the public areas of my forum using 'view attachments to posts'. I'm going to have to investigate this more.


XenForo developer
Staff member
I'm not positive, but I believe this may ultimately be a quirk of Android. We send non-image files as forced downloads with a generic MIME type to prevent various security issues and I suspect this is the conflict. I will need to do more testing to see if there's a potential workaround, but I'm not sure yet.


Active member
I have to chime in that my users also have this same issue. I just tested it with Chrome on iOS and I get a cocoa error. It can view all attachments fine. The attachments are generally a .png and not a different file type that iOS can't handle.

I am looking into it myself as well to see if it is specific to something I have done or a general bug and will update this post accordingly.