• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Issues with IE and Mozilla Firefox

 
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good day!

I have to get the complete path of a filename and then save it to the database. The problem is that when I use Firefox, it only gets the filename say, test.txt. But when I use IE the same code gets the full path say, C:/Documents and Settings/User's Files/Webapps/test.txt. Which is the correct one. Is there a workaround on this?

Thanks.
God bless.

Darren
 
Ranch Hand
Posts: 2108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you talking about javascript?
 
Darren Alexandria
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi.

I am not sure. This is the first time I have encountered this problem and I have no idea how to solve it whether by Java code or javascript.
 
Jesus Angeles
Ranch Hand
Posts: 2108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You posted in other topics also. Is this the same question? You probably should stick to just 1 place. It will create unnecessary duplication of discussions, and confusion.

You posted java codes in the other topic, and you mentioned browser. So are you using applets? or jsp?
 
Darren Alexandria
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I did not post it to other categories. In= posted it on Java in General (Advanced) and when I got back it now has a duplicate entry in HTML/Javascript. In the first place I don't know how to move posts.
 
Darren Alexandria
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I posted it in java in general because because I really really don't have an idea about it. I thought that maybe a java code will solve the problem. i thought its a general question.

I am using JSP.
 
Rancher
Posts: 4803
7
Mac OS X VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Darren Alexandria:

I am using JSP.



Hmmm, are you using Javascript or EL with your JSP?

The basic cause is that different browsers do things differently. Not only IE versus Mozilla, but different versions of IE within themselves. Sometimes different versions of FireFox implement things differently.

Of course, when IE handles things badly, its the developer of the Java/JSP/javascript/EL that has to fix it. Sometimes life is unfair.

Even browsers that are built on the same base, say SeaMonkey and FireFox
can and do have quirks.

Perhaps if you can post a bit of the HTML or JSP code, we can better understand, and help.
 
Darren Alexandria
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
May I ask what is EL? I don't have javascript in my code.

here's my code for uploading:


When I use this code and use IE, I get the complete path using getName() method. But in Firefox only the filename is being shown.

Thanks so much.
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You will not be able to get the full file path from FireFox. Nothing you can do about it. Why do you need it?
 
Darren Alexandria
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My boss wants my code to run efficiently in any browser. That's why I am having a hard time here.

Thanks.
 
Bear Bibeault
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Darren Alexandria:
My boss wants my code to run efficiently in any browser.

What does knowing the file path on the client have to do with efficiency? Why do you need the client file path?
 
Darren Alexandria
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As of now I cannot answer why my boss needs it. He's not around today. He just wants me to get the path and save it to the database.

Last week we encountered problems with upload. We are using Eclipse 3.2 with myEcplise plugin, Tomcat 5.5.23 and Apache Ant. When I right click on the file and choose "Run on server" the files are uploaded in the database with a breeze. But when I use Ant to deploy and then Run Tomcat manager and choose my application, I encountered an error which is "The System cannot find specified file". During that time I am only getting the filename of the file and save it to the database. But since that problem occured, He now wants me to get the whole path.

I think that is where all of this started.
 
Bear Bibeault
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Darren Alexandria:
During that time I am only getting the filename of the file and save it to the database. But since that problem occured, He now wants me to get the whole path.

I don't see how knowing where the file originally came from is going to help solve a problem serving it from the database after the fact.

In any case, the requirement cannot be met.

In fact, what IE is doing is wrong, and just one of the many security issues it has. Information about the file system of the client should never be exposed to the server.
 
Darren Alexandria
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
well, I really don't know what to do now. If that is not the solution thenwhat should I do to solve the problem when using Ant?

thanks again.
 
Pat Farrell
Rancher
Posts: 4803
7
Mac OS X VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Darren Alexandria:
May I ask what is EL? I don't have javascript in my code.



EL is "expression language" which is the language that browser side pages using JSP talk when binding to Beans.

I was asking about the code on the browser side. You showed the server side, but there typically is some HTML or JSP on the browser that contains your interaction. i.e. the form that drives the GET or PUT.

But other folks in the thread say the behaviour is a feature. As I wrote earlier, when Microsoft's IE or FireFox or anything else has bugs, its still your problem to fix.

I don't see how ANT has anything to do with the problem or the solution.
 
Bear Bibeault
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Darren Alexandria:
thenwhat should I do to solve the problem when using Ant?

The first step is to find out what the problem really is. This whole topic was just a stab in the dark.

If the data is getting stored correctly in the database, the upload process isn't part of the issue. If the data is corrupt in the database, then it most likely is a problem in the upload process. Find out which is the case.
 
Marshal
Posts: 28226
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So, taking a guess based on what you posted, your problem is this: your uploading works correctly when the server is running on the same machine as the client but not when the server is running on a different machine.

If that guess is correct, then my second guess is that instead of just taking the uploaded data from the request, your code is taking the file name from the request and trying to copy from that file into the database.

That idea would work if your server had the full path to the file and the file was already on the same machine as the server. But if either of those things are not true -- and you should expect both of them to be not true -- then it doesn't work. And that's just what you are describing.
 
Bear Bibeault
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good insight Paul! If the file is being read from the file system, rather than from a multi-part request, then indeed, that will not work in the general case. An entyr in the JSP FAQ discusses file uploading.
 
Darren Alexandria
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your comment Paul. I am enlightened. Yesterday I tried several scenarios:

1st scenario:

- File to be uploaded is on the Server
- Application "runs" on the Client

Result: File not uploaded and downloaded.

2nd scenario:

- File is to be uploaded is on the Client
- Application "runs" on the Server

Result: File Uploaded and Downloaded. All uploaded files are corrupted (out of 675bytes only 42 bytes are copied.)

What I mean by "run" is I access the application through the Tomcat Manager then I type this to the address bar: http://localhost:8080/application/index.jsp

I also observed that if in the folder where I download the files already has contents, the file contents are appended.

Thanks all for your replies. Specially to Paul and Bear. This is a big help for starters like me.

God bless.
 
Darren Alexandria
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the JSP FAQ, I tried the codes in "Using HTML File Upload". And it worked for me. That's the reason why I am using it right now. Did I use the right method? Or should I use something else?

Thanks.
 
reply
    Bookmark Topic Watch Topic
  • New Topic