The moose likes Other JSE/JEE APIs and the fly likes Problem with recognizing file type Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Reply Bookmark "Problem with recognizing file type" Watch "Problem with recognizing file type" New topic
Author

Problem with recognizing file type

Farakh khan
Ranch Hand

Joined: Mar 22, 2008
Posts: 625
Hello,

I am using Tomcat with 64 bit and it runs all the classes fine. I am compiling them to 32 bit on another computer as my dedicated online server is 32 bit and tomcat is connected with apache through mod_jk connector.

This code is working fine on offline computer but when am uploading my class to online dedicated server it prints "Only zip file is accepted".
I checked and printed the file type in 3 different browsers and browser showing correct file type i.e. application/zip

Is there any problem with apache or tomcat or anything else?

Here is my code:



Thanks in anticipation
Rob Spoor
Saloon Keeper

Joined: Oct 27, 2005
Posts: 18368

Farakh khan wrote:

Leave that out. f14 is a File object and will never be equal to any String.


That if statement will always be executed. You're saying that if the file type is not application/zip or not application/x-zip-compressed the block should be exected. Since these two Strings are different, the file type will always be different from one of the two; if it's application/zip then it's not application/x-zip-compressed and vice versa. Change the || into &&, and the block will be executed if the file type is neither of the two Strings - exactly what you want.


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
 
 
subject: Problem with recognizing file type
 
Threads others viewed
Uploading file from Tomcat-Aoache server to IIS web server
Accessing image in a zip file
Some errors
Servlet hosting problem
URGENT: Transferring Zip Files
developer file tools

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture