cancel
Showing results for 
Search instead for 
Did you mean: 

File upload element - how to get the entire file path

SandipAgarwalla
Active Contributor
0 Kudos

Hi All,

Is there any way to get the entire client path of the file being uploaded using file upload UI.

I need to get the path from the client machine as, <b>D:\Folder_A\File.doc</b>.

Thanks

Sandip

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Sandip,

This is totally impossible for Web applications (not only WD, any Web applications) due to security restrictions -- full path on client computer is very security sensitive information.

Valery Silaev

SaM Solutions

http://www.sam-solutions.net

SandipAgarwalla
Active Contributor
0 Kudos

Thanks for the info Valery.

But somehow I have to get the file path. Actually this file path will be sent to an applet. That applet in turn will open the file for further processing. Is there any way to get it?

Thanks

Sandip

Message was edited by:

Sandip Agarwal

Former Member
0 Kudos

Sandip,

Actually, I see only two options:

-- let user to select file via applet (i.e. use AWT or Swing FileChooser) - anyway you have to sign applet to let it read file, so using FileChooser shouldn't be a problem

-- don't use WD but rather use your custom WAR application with HTML (example below) and servlet that processing result:


<html>
  <body>
    <form action="servlet-url" method="POST" 
      onsubmit=
      "this.fileName.value = document.getElementById('inFile').value;">
      <input type="hidden" name="fileName" /> 
      <label for="inFile">Select file:</label><input type="file" id="inFile" />
    </form>
    <!-- REMOVE THIS, ONLY FOR TESTING -->
    <button onclick="alert(document.getElementById('inFile').value)">Clcik</button>
  </body>
</html>

onsubmit script stores name of select file into hidden variable accessible as request parameter in servlet. Btw, file itself should not be transfered in example above, to transfer content as well (if you really need it) replace <input type="file"... with <input name="inFile" type="file".. -- i.e. assign name to control

Valery Silaev

SaM Solutions

http://www.sam-solutions.net

Message was edited by:

Valery Silaev

Message was edited by:

Valery Silaev

SandipAgarwalla
Active Contributor
0 Kudos

Thanks Valery

That will be useful.

Regards

Sandip

SandipAgarwalla
Active Contributor
0 Kudos

Hi Valery,

Sorry for opening this thread again..

It seems i might have to use web dynpro for the applet as it does communicate with lot of SAP R/3.

Is there a way some how I can get the entire path of file in web dynpro.

Thanks in advance.

Regards

Sandip

Former Member
0 Kudos

I why dont you just use the upload element with its file picker then you will have the file content in the web dynpro context and can manipulate it the way you want. We use this techinque to go through/parse .xml files and copy text receipt files to be stored in CMS system. Think you might be thrashing against the framework by trying to specifically get at the full path name?

SandipAgarwalla
Active Contributor
0 Kudos

Hi Steven,

Basically my the Web DYnpro application is not in file content manipulation. It just need to get the file and pass the file path to an applet, which is a client side plug in. This applet is going to do it's on operation with the file.

So thats why I am not interested in the file content as of now. Is there a way to do this?

Regards

Sandip

Answers (1)

Answers (1)

Former Member
0 Kudos

Sandip,

Sorry, I have not used the in file Uploader in this capacity to get a full file name. I have used it to uploaded a client file and then copied it to an in house server so that another system can read the file and manipulate it. I would have to experiment myself to see if there is a way to do it as you are describing, I do not know of any techinque off hand.