-1

When my Clients download a rar from my website (ravens-hangar.tk) a big script of lines popping up. Need Help!? Thanks in Advance!

.download {
  width: 120px;
  height: 30px;
  font-size: 20px;
  text-align: center;
  background: #35424a;
  border: none;
  color: white;
}
<td><img src="img/template7.png" alt=""><a href="repaints/ma.rar" download="ma'"><button type="button" class="download">Download</button></a></td>

https://i.stack.imgur.com/TGoFg.jpg

2 Answers2

0

As I stated in comments, your server must set the proper headers in the HTTP response. Something like this:

Content-Type: application/octet-stream
Content-Disposition: attachment; filename="ma.rar"

To fix this, it depends on how your webpage and files are served. You have to read the documentation about 'How to properly serve your files'.

sjahan
  • 5,720
  • 3
  • 19
  • 42
  • So I will add it on the html? or css? – Raven Lescano Oct 09 '17 at 08:03
  • 1
    This is neither about CSS nor about HTML. It is about your HTTP server, that is the component that sends the rar file (and the html webpages of your site certainly) to the browser. – sjahan Oct 09 '17 at 08:05
  • If you do not deal with the backend, ask in your team. It could be Apache HTTP server, nginx, tomcat, node, i don't know! You must first figure out which server you use, then, you will be able to find some documentation about it, and learn how to properly save this kind of files. – sjahan Oct 09 '17 at 08:08
  • can i put in htcacces? – Raven Lescano Oct 09 '17 at 23:54
  • with this? ` ForceType application/octet-stream Header set Content-Disposition attachment ` – Raven Lescano Oct 09 '17 at 23:57
  • As you mention htaccess, i'll guess that you are using Apache HTTP Server. Your answer must be quite close, maybe the regex won't work though... Please have a look at this: https://stackoverflow.com/questions/8056839/apache-directive-for-file-downloads – sjahan Oct 10 '17 at 07:03
  • I've check and it is nginx @sjahan – Raven Lescano Oct 10 '17 at 07:12
  • If you're using nginx, you must be able to find some stuff around the web: check this out for instance: https://stackoverflow.com/questions/9054354/how-to-force-file-download-in-the-browser-nginx-server – sjahan Oct 10 '17 at 12:10
0

if you remove the value of the attribute "download" the file is download normally or if you want another name write it with correct ending of your file like "another-ma.rar" not just "ma'" without file type. I think that button tag in a tag it's bad idea, maybe better give class="download" to anchor tag? http://w3c.github.io/html/#the-a-element

I mean that if href="img.jpeg" it will open image in browser, but if you add download attr it will download image ;)

.download {
  display:inline-block;
  width: 120px;
  height: 30px;
  font-size: 20px;
  text-align: center;
  background: #35424a;
  border: none;
  color: white;
}
<td><img src="img/template7.png" alt=""><a class="download" href="repaints/ma.rar" download>Download</a></td>