Welcome to Dream.In.Code
Become an Expert!

Join 149,506 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,331 people online right now. Registration is fast and FREE... Join Now!




.rar files in tomcat

2 Pages V  1 2 >  
Reply to this topicStart new topic

.rar files in tomcat, help me,please

tleaha
23 Jul, 2007 - 03:36 AM
Post #1

New D.I.C Head
*

Joined: 23 Jul, 2007
Posts: 6


My Contributions
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. sad.gif if you konw how to do,tell me please.

Thanks for advance
tleaha
User is offlineProfile CardPM
+Quote Post

serializer
RE: .rar Files In Tomcat
23 Jul, 2007 - 07:01 AM
Post #2

D.I.C Head
**

Joined: 25 Jun, 2007
Posts: 108


My Contributions
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

User is offlineProfile CardPM
+Quote Post

tleaha
RE: .rar Files In Tomcat
24 Jul, 2007 - 01:23 AM
Post #3

New D.I.C Head
*

Joined: 23 Jul, 2007
Posts: 6


My Contributions
serializer,thanks for your answer smile.gif

CODE
<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-->

CODE
Rar!�ϐs�� �������{t 6�����B7'63� ���route1\index.html�$= {ZsUh4vD`9 8%-V&v %m"S:l6'WnӬӻ�9< gMa>'Er݁, uձzȾ Tz p
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?


User is offlineProfile CardPM
+Quote Post

no2pencil
RE: .rar Files In Tomcat
24 Jul, 2007 - 03:22 AM
Post #4

My fridge be runnin OH NOEZ!
Group Icon

Joined: 10 May, 2007
Posts: 7,121



Thanked: 76 times
Dream Kudos: 2425
Expert In: Goofing Off

My Contributions
You have
CODE

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

It should read
CODE

<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 Jul, 2007 - 03:23 AM
User is online!Profile CardPM
+Quote Post

serializer
RE: .rar Files In Tomcat
24 Jul, 2007 - 06:05 AM
Post #5

D.I.C Head
**

Joined: 25 Jun, 2007
Posts: 108


My Contributions
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


User is offlineProfile CardPM
+Quote Post

tleaha
RE: .rar Files In Tomcat
24 Jul, 2007 - 11:40 PM
Post #6

New D.I.C Head
*

Joined: 23 Jul, 2007
Posts: 6


My Contributions

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
User is offlineProfile CardPM
+Quote Post

serializer
RE: .rar Files In Tomcat
25 Jul, 2007 - 06:55 AM
Post #7

D.I.C Head
**

Joined: 25 Jun, 2007
Posts: 108


My Contributions
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
User is offlineProfile CardPM
+Quote Post

tleaha
RE: .rar Files In Tomcat
26 Jul, 2007 - 08:36 AM
Post #8

New D.I.C Head
*

Joined: 23 Jul, 2007
Posts: 6


My Contributions
smile.gif 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

User is offlineProfile CardPM
+Quote Post

serializer
RE: .rar Files In Tomcat
27 Jul, 2007 - 05:13 AM
Post #9

D.I.C Head
**

Joined: 25 Jun, 2007
Posts: 108


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

Let me know if it works!

--serializer
User is offlineProfile CardPM
+Quote Post

tleaha
RE: .rar Files In Tomcat
27 Jul, 2007 - 07:50 AM
Post #10

New D.I.C Head
*

Joined: 23 Jul, 2007
Posts: 6


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

tleaha
User is offlineProfile CardPM
+Quote Post

serializer
RE: .rar Files In Tomcat
27 Jul, 2007 - 08:53 AM
Post #11

D.I.C Head
**

Joined: 25 Jun, 2007
Posts: 108


My Contributions
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
User is offlineProfile CardPM
+Quote Post

tleaha
RE: .rar Files In Tomcat
27 Jul, 2007 - 01:06 PM
Post #12

New D.I.C Head
*

Joined: 23 Jul, 2007
Posts: 6


My Contributions
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 Jul, 2007 - 01:07 PM
User is offlineProfile CardPM
+Quote Post

2 Pages V  1 2 >
Fast ReplyReply to this topicStart new topic
Time is now: 1/7/09 07:01PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month