Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Attachments download an attachment.php file instead of the attachment itself

[emoji848]
Legend
Joined
Dec 3, 2011
Messages
2,232
Reaction score
1,518
I'm basically having the same issue as pokchop had right now: http://forum.ragezone.com/f598/file-attachments-990524/

When I try downloading the attachment from this thread: http://forum.ragezone.com/f908/help-lot-errors-1097089/
I end up downloading several attachment.php files instead of the attachment itself:

attach10.png


I'm using Google Chrome 48.0.2564.116 with Windows 10 at the moment

I've had this in the past and it was solved temporarily I think but I don't remember how (if it was something I needed to do).

I also did a search for it here in the bug reports but I could only find pokchop1's thread which is unanswered and I didn't wanna bump a 2 yo thread, so I'm sorry if this has an answer already somewhere :s

Edit: I just found out that the file is being downloaded correctly, just the extension is wrong. When renaming the file to .rar instead of .php it actually works. Maybe this is just a naming problem?
 
Last edited:
Moderator
Staff member
Moderator
Joined
Jul 30, 2012
Messages
1,103
Reaction score
432
Works fine for me as Version 48.0.2564.116 m (64-bit) of Google Chrome.

Here's a mirror of the file you tried to download in case you need it urgent:

EDIT: See your edit, nervermind. Anyway, its working fine me; it downloads it as a .rar and only 1 file.
 
[emoji848]
Legend
Joined
Dec 3, 2011
Messages
2,232
Reaction score
1,518
Thanks for the feedback. Yes it downloads only 1 time for me as well, I just gave it several tries.
It's really strange that it works as .rar for you on the same version of Google Chrome. What's your operating system?
I just tried "saving the link as" by right clicking it, but that does the same thing for me.
 
Moderator
Staff member
Moderator
Joined
Jul 30, 2012
Messages
1,103
Reaction score
432
I just tried it again and now it downloads as attachment.php. I am clueless since clearly it worked earlier, seeing I've even made a mirror of it.

Windows 10 OS btw.
 
Banned
Banned
Joined
Aug 10, 2011
Messages
201
Reaction score
54
If you change the extension name from .php to .rar you'll be able to open the file ijs

Edit : btw issue still occurs
 
[emoji848]
Legend
Joined
Dec 3, 2011
Messages
2,232
Reaction score
1,518
I just found out that the file is being downloaded correctly, just the extension is wrong. When renaming the file to .rar instead of .php it actually works. Maybe this is just a naming problem?

I added that info already. Also didn't download attachments till now so I can't say whether it still occurs
 
Banned
Banned
Joined
Aug 10, 2011
Messages
201
Reaction score
54
I added that info already. Also didn't download attachments till now so I can't say whether it still occurs

Still occurs if you try to download the attachment that you once downloaded before like Kimberly stated
 
Joined
Apr 24, 2013
Messages
1,682
Reaction score
1,124
I downloaded it with ghostery browser on my phone and it picked up .rar as the extension. Maybe it is really a chrome problem.



Tried it for a second time, it picks .rar as the extension again.



@MentaL



And now fix it :)

Edit:

This will only be of benefit when you're dealing with an HTML file or an image. If you navigate to a rar file, the browser will download it automatically.



You need to set the correct Content-Type (MIME type of the file) and Content-Disposition (attachment + filename ending with the extension) headers of the download with PHP.
 
Joined
Jun 23, 2010
Messages
2,318
Reaction score
2,195
I downloaded it with ghostery browser on my phone and it picked up .rar as the extension. Maybe it is really a chrome problem.

It's the same for IE/FF, so that's not the case.

Try download the file and refresh the page and download it again.


This will only be of benefit when you're dealing with an HTML file or an image. If you navigate to a rar file, the browser will download it automatically.

The download attribute tells the browser to download the link, the value you give is the name of the file so you can override the links filename.
Normally the browser will indeed download a rar file, but because you navigate to a php file it won't.

You need to set the correct Content-Type (MIME type of the file) and Content-Disposition (attachment + filename ending with the extension) headers of the download with PHP.

That would also be a legit solution.
 
Joined
Apr 24, 2013
Messages
1,682
Reaction score
1,124
These are the current download headers:

mZ3XQiZ.png


It makes use of the Content-Type application/rar, which doesn't exist. For rar files the Content-Type should be application/x-rar-compressed

It's also missing the Content-Disposition header, which sends the filename to the browser and tells the browser it's a downloadable file, for the attachment that @Future had the problem with, the Content-Disposition header should be:
attachment; filename="logs.rar"



The download attribute tells the browser to download the link, the value you give is the name of the file so you can override the links filename.
Normally the browser will indeed download a rar file, but because you navigate to a php file it won't.

True! ^^ I doubt it will work with only the download attribute though, since the browser is still sending the headers of a PHP file.
 

Attachments

You must be registered for see attachments list
Back
Top