12 Replies - 2330 Views - Last Post: 27 July 2007 - 02:34 PM

#1 tleaha  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 23-July 07

.rar files in tomcat

Post icon  Posted 23 July 2007 - 04:36 AM

hi all

i'm student and doing a first website porject,but now i have some problem with my html code.
I want to know how to create a link with my .rar file for download.I'm trying to solve this problem with tag <a> but it dosen't work. :( if you konw how to do,tell me please.

Thanks for advance
tleaha
Is This A Good Question/Topic? 0
  • +

Replies To: .rar files in tomcat

#2 serializer  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 110
  • Joined: 25-June 07

Re: .rar files in tomcat

Posted 23 July 2007 - 08:01 AM

Should just be something like:

<a href="files/myfile.rar">Download this file</a>

Problems could be:

- Web servers tend to be case-sensitive, make sure the capitalisation of your file name is correct
- Take any spaces out of the file name, these can confuse things
- Make sure you use forward slashes for path separators

Of course since you didn't post any code this is just guesswork. If you had posted code I could have told you in about 2secs exactly what the problem was. Are you all clear on this, that posting code really helps people in working out what is wrong with the code?

Please post some code, and/or a link to the page in question.

--serializer
Was This Post Helpful? 0
  • +
  • -

#3 tleaha  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 23-July 07

Re: .rar files in tomcat

Posted 24 July 2007 - 02:23 AM

serializer,thanks for your answer :)

<a herf="/route1.rar"> click if you dare!!</a>


Ummm!! sorry,i'm forgot to tell about my project. i used jsp that is java mixed html and i used sun creator2 to coding.when i was run this code and click on "click if you dare!!" link, i got the output like this-->

Rar!�ϐs�� �������{t 6�����B7'63� ���route1\index.html�$= {ZsUh4vD`98%-V&v %m"S:l6'WnӬӻ�9<gMa>'Er݁,uձzȾ Tzp 
and so on

later,i thought this problem may be related compress file extention so i compressed file again and changed extention from .rar to .zip ,and i can download these file.i don't know,why?
Was This Post Helpful? 0
  • +
  • -

#4 no2pencil  Icon User is offline

  • Toubabo Koomi
  • member icon

Reputation: 5247
  • View blog
  • Posts: 27,066
  • Joined: 10-May 07

Re: .rar files in tomcat

Posted 24 July 2007 - 04:22 AM

You have
<a herf="/route1.rar"> click if you dare!!</a>


It should read
<a href="/route1.rar"> click if you dare!!</a>


You have the e & the r switched in href.

This post has been edited by no2pencil: 24 July 2007 - 04:23 AM

Was This Post Helpful? 0
  • +
  • -

#5 serializer  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 110
  • Joined: 25-June 07

Re: .rar files in tomcat

Posted 24 July 2007 - 07:05 AM

As no2pencil points out it should be href not herf, but that wouldn't cause the problem you describe so I think you must have got it right originally.

If the file just "dumps" to the browser window instead of correctly downloading, it could be a problem with your web server. When a file is downloaded on HTTP, the first thing that is transmitted is the MIME type, for instance application/zip for .zip files, or application/x-rar-compressed for .rar files. Most likely they have the correct entry for zip, but not for rar, so the browser is assuming it is just text; the funny symbols you see are what happens when you try to view binary data as plain text.

Who are your web hosts? You will probably need to contact them to resolve this issue. If it's an Apache server then you can add a command to a .htaccess file to enable different MIME types. Let me know if this is the case, I'll dig out the command for you.

--serializer
Was This Post Helpful? 0
  • +
  • -

#6 tleaha  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 23-July 07

Re: .rar files in tomcat

Posted 25 July 2007 - 12:40 AM

i used Tomcat server as a localserver.
i thought it could be follow serializer reply and i'll find out too.

thank you so much for your kind serializer

tleaha
Was This Post Helpful? 0
  • +
  • -

#7 serializer  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 110
  • Joined: 25-June 07

Re: .rar files in tomcat

Posted 25 July 2007 - 07:55 AM

Don't know about tomcat but somewhere it'll have a configuration file for MIME types. Hopefully when you move to a live server they should already have it set up.

--serializer
Was This Post Helpful? 0
  • +
  • -

#8 tleaha  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 23-July 07

Re: .rar files in tomcat

Posted 26 July 2007 - 09:36 AM

:) i was found out how to configure mime type on Tomcat but i didn't found mime type of .rar to fix it.

ps. you can configure mime type of tomcat server in..\Tomcat\conf\web.xml path

tleaha
Was This Post Helpful? 0
  • +
  • -

#9 serializer  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 110
  • Joined: 25-June 07

Re: .rar files in tomcat

Posted 27 July 2007 - 06:13 AM

I think application/x-rar-compressed is the correct type.

Let me know if it works!

--serializer
Was This Post Helpful? 0
  • +
  • -

#10 tleaha  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 23-July 07

Re: .rar files in tomcat

Posted 27 July 2007 - 08:50 AM

application/x-rar-compressed it dosen't work.The output are still funny symbols.

tleaha
Was This Post Helpful? 0
  • +
  • -

#11 serializer  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 110
  • Joined: 25-June 07

Re: .rar files in tomcat

Posted 27 July 2007 - 09:53 AM

Try application/octet-stream as a more standard type for binary data.

Otherwise, it could be a problem with your operating system or browser installation. Have you tried with both IE and FF?

--serializer
Was This Post Helpful? 0
  • +
  • -

#12 tleaha  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 23-July 07

Re: .rar files in tomcat

Posted 27 July 2007 - 02:06 PM

i think cause of this problem could be from browser as your reply.

i tried to run both application/octet-stream and application/x-rar-compressed when i tried with FF ,it's work but IE doesn't work.???

tleaha

This post has been edited by tleaha: 27 July 2007 - 02:07 PM

Was This Post Helpful? 0
  • +
  • -

#13 serializer  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 110
  • Joined: 25-June 07

Re: .rar files in tomcat

Posted 27 July 2007 - 02:34 PM

Post a link to the page in question, I can test if it's a general IE issue with the server, or if your installation's broken.

--serializer
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1