Getting the full client location on a file upload

View: New views
2 Messages — Rating Filter:   Alert me  

Getting the full client location on a file upload

by Joe C :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This is my first post, so please bear with me, if I haven't done this
correctly (and please correct me).  

 

When I am uploading a file in a form, I want to save the full client path of
the file, but I am not sure how to access that information.  My code looks
like this:

 

                  final FileUpload upload = fileUploadField.getFileUpload();


                  if (upload != null){

                        ......

                              // Save to new file

File newFile = new File(....)

                              newFile.createNewFile();

                              upload.writeTo(newFile);                  

                              //Want to get the full path here, e.g.
c:\clientComputer\myFolder\myFile.txt

                              String fullPath = ?????

 

                        } catch (Exception e){

                              //yatta yatta yatta

                        }

                  }

 

 

Thx,

 

Joe Celano

 


Re: Getting the full client location on a file upload

by Michael Sparer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

correct me if i'm wrong but AFAIK, it depends on which browser the uploader is using. Some browser send the whole path with the request, some only the filename ... firefox e.g. just sends the filename without the path

regards,
Michael

Joe C wrote:
This is my first post, so please bear with me, if I haven't done this
correctly (and please correct me).  

 

When I am uploading a file in a form, I want to save the full client path of
the file, but I am not sure how to access that information.  My code looks
like this:

 

                  final FileUpload upload = fileUploadField.getFileUpload();


                  if (upload != null){

                        ......

                              // Save to new file

File newFile = new File(....)

                              newFile.createNewFile();

                              upload.writeTo(newFile);                  

                              //Want to get the full path here, e.g.
c:\clientComputer\myFolder\myFile.txt

                              String fullPath = ?????

 

                        } catch (Exception e){

                              //yatta yatta yatta

                        }

                  }

 

 

Thx,

 

Joe Celano

 
LightInTheBox - Buy quality products at wholesale price!