aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes How to get the complete file path in Mozila Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to get the complete file path in Mozila" Watch "How to get the complete file path in Mozila" New topic
Author

How to get the complete file path in Mozila

gangadhar Kurra
Greenhorn

Joined: Mar 10, 2011
Posts: 3
Hi all,

I am unable to get complete file path while using Mozila but i can able to get the path in IE. can some one help me how to get the file path using using java script.

am using <input type="file" name="test">

Thanks.


Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
You can not get the full path in modern day browsers due to security reasons.

Eric
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61421
    
  67

Having your web apps rely upon bugs in IE is not a good approach. Why do you need the full path? I suggest re-thinking your approach.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
gangadhar Kurra
Greenhorn

Joined: Mar 10, 2011
Posts: 3
Thanks Bear & Eric.

Good to see Immediate response.

We are using DFS(Documentum Foundation Services) calls for uploading the Documents to the Documentum Server (EMC product). Using Oracle ADF screens.

In service calls it was expecting file path as argument. In ADF we have one component <af:inputFile> I was not seen any method to get the file path. For that we are writing file into the temporary path. That temporary path we are passing argument. For small files it was very fast but large files it was causing big performance issue.

instead of going input fie ADF componet. i tried following ways.

1 java script:
<input name="optionalFile" type="file" id="sample"></input>
var test=document.getElementById('sample').value;

output: document name

2. through backing bean
FacesContext fctx = FacesContext.getCurrentInstance();
HttpServletRequest rq = (HttpServletRequest)fctx.getExternalContext().getRequest();
String filename=rq.getParameter("optionalFile");

output: null


can you suggest me some solution how to get the file path. please dont suggest post ADF forum or Documentum forum



Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
JavaScript and HTML will not give you the full path so there is nothing you can do on the clientside to get it. You might have to go applet/flash solution if you really need it, or you force people to type the path into a textbox OR you figure out some solution where you do not need the path .

Eric
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61421
    
  67

And, is the file path on the client really what you need or where the file is uploaded to the server?
gangadhar Kurra
Greenhorn

Joined: Mar 10, 2011
Posts: 3
Againe Thanks Eric & Bear.

Existing Model:

In ADF file component I will get the InputStream that we are writing into temporary file in the Application Server
UploadedFile file=(UploadedFile)valueChangeEvent.getNewValue();
file.getInputStream();

In Documentum Server to create any document i need to pass as Content class Object as parameter. i was not seen any method to pass inputstream directly. it looks path for the file.

public FileContent(String localpath,String format)

in this model it causing big big perfromence issue. Desktop->Application Server->Documentum Server instead of creating file in application server. if i know the path i can directly pass the path to my Service.

Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to get the complete file path in Mozila