Getting the full file path from FormFile

Hi, I am reading in a .csv file from my JSP page and I want to pass the String path from my Action class to the logic layer class. When I try and pass it at the moment, it throws an FileNotFound error as it is only passing the file name. i.e
Passing
text.csv
not
C:\text.csv
Is there anyway of detirming the full file path using the FormFile class?
Thanks in advance

Yes, as in Struts.
I am not trying to upload the file, simply trying to read the contents from the file. My problem is that I want to read the contents from one of my business logic classes, not within my struts Action. I can get it working if I use
byte[] datainfile = file.getFileData();
and then send that but the I would prefer to just send the full path to my Business logic class and process everything in there rather than doing some in my Action and some in my logic class.
So what I would like to put in my Action class is something such as
processCSVFile(String filePath);
instead of
processCSVFile(Byte[] formFile);

Similar Messages

  • Get the preferences file path ?

    Hi guys,
    is there any way to get the preferences file path from the SDK ?
    (exp : C:\Documents and Settings\[user]\Application Data\Adobe\Acrobat\8.0\Preferences)
    I'm using C++
    Thx in advance

    Yes, using the plugin APIs. There is a AVAppGetSpecialFolder() call that you can use.

  • Obtaining the full file path specification from Flash Movie and QuickTime icons?

    How do you obtain the full file path specification from Flash
    Movie and QuickTime icons? I want the path and the file name that
    is contained in these icons. I am using a "dive" to run through the
    icons of a file, and when I come upon these two types of icons, I
    want to obtain the above information that is contained in them. I
    certainly can look in the property dialog box to get this info, but
    there are many icons in these files, and I want to generate a list
    of info based upon the various types of icons that I am processing.
    Thanks

    > How do you obtain the full file path specification from
    Flash Movie and
    > QuickTime icons? I want the path and the file name that
    is contained in
    > these
    > icons. I am using a "dive" to run through the icons of a
    file, and when I
    > come
    > upon these two types of icons, I want to obtain the
    above information that
    > is
    > contained in them. I certainly can look in the property
    dialog box to get
    > this
    > info, but there are many icons in these files, and I
    want to generate a
    > list of
    > info based upon the various types of icons that I am
    processing. Thanks
    >
    For Flash
    Trace(GetIconProperty(iconID, #pathName))
    for QuickTime
    Trace(GetIconProperty(IconID, #filename))
    For full scripting reference for each of these sprites, open
    up the
    Properties panel for each sprite and press the Help button
    that appears on
    the properties page ... or else navigate to these folders for
    the Flash and
    QT help
    C:\Program Files\Macromedia\Authorware
    7.0\xtras\FlashAsset\Help
    C:\Program Files\Macromedia\Authorware
    7.0\xtras\QuicktimeAsset\Help
    You don't want to know how many times I asked Macromedia to
    stop hiding that
    Help!
    Steve
    http://twitter.com/Stevehoward999
    Adobe Community Expert: eLearning, Mobile and Devices
    European eLearning Summit - EeLS
    Adobe-sponsored eLearning conference.
    http://www.elearningsummit.eu

  • Missing Photographs - 5,000 in total - is there a programmatic way to get the complete file paths missing?

    HostOS : Mac OS X
    LightRoom version : 4.4
    I accidentally moved linked files over the past few years, and just discovered (via "Missing Photos" view) that I have 5,000 missing photos.
    I know the master photos are on my hard disk drive ... so, that is the good news.
    BUT I do not want to have to click to re-link all 5,000 missing photos one at a time.
    Is there a way to programmatically get the list of file paths of those 5,000 missing photos on my MacOSX system  -- so that I can write an AppleScript to extract the unique image file name from the full file path extracted from LightRoom, locate the image in Finder, and move it back to the expected file path where Lightroom expects to find it?

    If most of your reorganization consisted of moving whole folders rather than individual pics,  you can quickly relink entire folders, or even folders of folders, rather than individual pics.  In the Folders pane on the left, right-click the missing folder and select Find Missing Folder.
    If you moved individual files rather than entire folders, then to get a list of the file paths of all the missing files, first do Library > Find All Missing Photos. Then use the ListView plugin to get a list of the photos' file paths into a text file.

  • How to Get the Source File Path in the Receiver Side

    Hi Experts,
    Here We are Trying to Do How to Get the Sender Information ( File Name & Path ) on the Receiver Side .
    According to the Michal Blog
    /people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
    Here we Are Able to Get only the File Name.
    But If I Want to get the Total File  Path Also means What Should I Do Here ????
    Please Let Me Know
    Regards
    Khanna

    Khanna,
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey fkey = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
    DynamicConfigurationKey dkey = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","Directory");
    String fname = conf.get(fkey);
    Sring path = conf.get(dkey);
    String final=fname""path;
    return ""final"";
    Best regards,
    raj.

  • How do I get the full current path in the title bar of a terminal window?

    Is it possible to get the full current path in the title bar of a
    terminal window? I would find that more meaningful than
    "Terminal - tcsh - 80x60" (which I currently get). Doing
    this would free me from wanting to display the path in my
    system prompt thereby allowing me to use a shorter prompt
    and having more space on the line for actual input.
    Thanks
    Ron
    Dual 1Ghz PowerMac G4 Quicksilver 2002   Mac OS X (10.4.8)  

    IIRC, Terminal->Window Settings->Window controls that information. That said, I don't understand what full current path means in this context, nor why you'd want to display it in title bar.
    Your terminal prompt is a concatenation of your computer name (SysPrefs->Sharing—easily changed) and the path to your user's home directory using the short username (hard to change).
    computer name:~ username$

  • Display the full file path in title bar

    I apologize for my username. After getting a ton of "username already exists" I went to the keyboard crushing technique to find one that didn't.
    We currently use Adobe Acrobat 9.5.4
    I am assisting a user who would like the full file path of the opened PDF to display in Adobe's title bar. Right now it only displays the file name, as shown below -
    Instead of "Adbove Community_ Start New Discussion.pdf" he would ideally like to have "C:\users\unamehere\desktop\filename.pdf" or the full UNC path like "\\myserver\department\projectnumber\filename.pdf".
    Is this possible? Thank you in advance for any assistance you may be able to provide.

    Tell me about usernames...
    Unfortunately, I don't think there's any control of this. Adobe regularly change what appears, but they don't let us do it.

  • Teststand 1.03 - How can I get the sequence file path into an expression?

    The sequence file will be located at different locations on different computers. I need the base address of the sequence file to get to the correct limits file. How can I get the sequence file path into a string-local expression.
    Thanks

    As Ray described, the FindFile expression function and TS API method will seach all TS search directories and return to you the path of your file, assuming the file is located in the search directories.
    If you just want the path of a TS file that you have a reference to then there is a faster, easier method. You can use the Path property of the PropertyObjectFile class. In the attached example I use an AcitiveX Automation adapter step to call Path on the property RunState.SequenceFile. This returns the path to the current executing sequence file. Note that if you have not yet saved the sequence file then the path will be empty. In a subsequence step I strip off the file name leaving the root path of the file.
    Attachments:
    GetSeqFilePath.seq ‏22 KB

  • How to get the long file name from an 8.3 name in Windows.

    Because of a legacy string limitation, I have a list of files in 8.3 format. The actual files are saved with long names. How can I get the long name from the short name?
    In JavaScript, I would get a file system object and get the file object from there with the short name. Then it's no problem to get the full name. But I don't see anything in Java that matches that. ???
    Ideas?
    Frank Perry, MSEE

    Here is what I did.
    String displayName = "somefi~1.txt";
    File fO = new File("c:\\"); // I have a more involved path but that's not important here.
    String stPath = fO.getPath() + displayName;
    File fD = new File(stPath); // get the file using the short name.
    File fDc = new File(fD.getCanonicalPath()); // get another file using the cononical name
    String FulldisplayName = fDc.getName(); // get the long name from there.
    It's roundabout but it works. Since getName() on the file read with the short name only returns the name used to get the file, I open it twice. The alternative is to parse the cononical name for the file name but that's clumbsy too.
    Frank

  • How can I get the full VI path of a step?

    I can get the VI file name by with Step.TS.SData.ViCall.VIPath but is it possible to get the full path?
    CLD (2014)

    Hi,
    TestStand uses relative paths, so it never actually stores the full path to the VI unless you specify an absolute path.
    If you would like to find the full path of where it has been found, you can use the method Engine.FindFile or the expression function FindFile to find where TestStand is locating this file.
    Matt M
    NI

  • How to get the full file content in the spool

    Hi,
         I am reading one fine from application server. I am getting all that content into one internal table. Again I am trying to write that one into spool. I am creating one spool by using
         CALL FUNCTION 'GET_PRINT_PARAMETERS'
        EXPORTING
         DESTINATION    = P_PADEST
          DESTINATION    = lv_dest
          LIST_NAME      = lv_name
         LIST_TEXT      = P_LNAME
          LIST_TEXT      = 'Label Print'
          IMMEDIATELY    = 'X'
          RELEASE        = ' '
          NEW_LIST_ID    = 'X'
          EXPIRATION     = 9
          LAYOUT         = 'X_65_80'
          SAP_COVER_PAGE = ' '
          RECEIVER       = SY-UNAME
          DEPARTMENT     = 'SYSTEM'
          NO_DIALOG      = 'X'
        IMPORTING
          OUT_PARAMETERS = IS_PARAMS
          VALID          = V_VALID.
           but in the spool i am not getting full content. In the internal table i am getting full content but in the spool some 5 to 6 lines are truncating at the last. How can i get the full content? For this i need to do any settings?
    Pls suggest reg this.

    may be the rest of the data is in another page. how many pages your spool showing. just check in SP01 . from menu Goto -> Display Requests -> Settings ->
    change the page numbers to view the other pages.

  • How to get the target file name from an URL?

    Hi there,
    I am trying to download data from an URL and save the content in a file that have the same name as the file on the server. In some way, what I want to do is pretty similar to what you can do when you do a right click on a link in Internet Explorer (or any other web browser) and choose "save target as".
    If the URL is a direct link to the file (for example: http://java.sun.com/images/e8_java_logo_red.jpg ), I do not have any problem:
    URL url = new URL("http://java.sun.com/images/e8_java_logo_red.jpg");
    System.out.println("Opening connection to " + url + "...");
    // Copy resource to local file                   
    InputStream is = url.openStream();
    FileOutputStream fos=null;
    String fileName = null;
    StringTokenizer st=new StringTokenizer(url.getFile(), "/");
    while (st.hasMoreTokens())
                    fileName=st.nextToken();
    System.out.println("The file name will be: " + fileName);
    File localFile= new File(System.getProperty("user.dir"), fileName);
    fos = new FileOutputStream(localFile);
    try {
        byte[] buf = new byte[1024];
        int i = 0;
        while ((i = is.read(buf)) != -1) {
            fos.write(buf, 0, i);
    } catch (Throwable e) {
        e.printStackTrace();
    } finally {
        if (is != null)
            is.close();
        if (fos != null)
            fos.close();
    }Everything is fine, the file name I get is "e8_java_logo_red.jpg", which is what I expect to get.
    However, if the URL is an indirect link to the file (for example: http://javadl.sun.com/webapps/download/AutoDL?BundleId=37719 , which link to a file named JavaSetup6u18-rv.exe ), the similar code return AutoDL?BundleId=37719 as file name, when I would like to have JavaSetup6u18-rv.exe .
    URL url = new URL("http://javadl.sun.com/webapps/download/AutoDL?BundleId=37719");
    System.out.println("Opening connection to " + url + "...");
    // Copy resource to local file                   
    InputStream is = url.openStream();
    FileOutputStream fos=null;
    String fileName = null;
    StringTokenizer st=new StringTokenizer(url.getFile(), "/");
    while (st.hasMoreTokens())
                    fileName=st.nextToken();
    System.out.println("The file name will be: " + fileName);
    File localFile= new File(System.getProperty("user.dir"), fileName);
    fos = new FileOutputStream(localFile);
    try {
        byte[] buf = new byte[1024];
        int i = 0;
        while ((i = is.read(buf)) != -1) {
            fos.write(buf, 0, i);
    } catch (Throwable e) {
        e.printStackTrace();
    } finally {
        if (is != null)
            is.close();
        if (fos != null)
            fos.close();
    }Do you know how I can do that.
    Thanks for your help
    // JB
    Edited by: jb-from-sydney on Feb 9, 2010 10:37 PM

    Thanks for your answer.
    By following your idea, I found out that one of the header ( content-disposition ) can contain the name to be used if the file is downloaded. Here is the full code that allow you to download locally a file on the Internet:
          * Download locally a file from a given URL.
          * @param url - the url.
          * @param destinationFolder - The destination folder.
          * @return the file
          * @throws IOException Signals that an I/O exception has occurred.
         public static final File downloadFile(URL url, File destinationFolder) throws IOException {
              URLConnection urlC = url.openConnection();
              InputStream is = urlC.getInputStream();
              FileOutputStream fos = null;
              String fileName = getFileName(urlC);
              destinationFolder.mkdirs();
              File localFile = new File(destinationFolder, fileName);
              fos = new FileOutputStream(localFile);
              try {
                   byte[] buf = new byte[1024];
                   int i = 0;
                   while ((i = is.read(buf)) != -1) {
                        fos.write(buf, 0, i);
              } finally {
                   if (is != null)
                        is.close();
                   if (fos != null)
                        fos.close();
              return localFile;
          * Returns the file name associated to an url connection.<br />
          * The result is not a path but just a file name.
          * @param urlC - the url connection
          * @return the file name
          * @throws IOException Signals that an I/O exception has occurred.
         private static final String getFileName(URLConnection urlC) throws IOException {
              String fileName = null;
              String contentDisposition = urlC.getHeaderField("content-disposition");
              if (contentDisposition != null) {
                   fileName = extractFileNameFromContentDisposition(contentDisposition);
              // if the file name cannot be extracted from the content-disposition
              // header, using the url.getFilename() method
              if (fileName == null) {
                   StringTokenizer st = new StringTokenizer(urlC.getURL().getFile(), "/");
                   while (st.hasMoreTokens())
                        fileName = st.nextToken();
              return fileName;
          * Extract the file name from the content disposition header.
          * <p>
          * See <a
          * href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html">http:
          * //www.w3.org/Protocols/rfc2616/rfc2616-sec19.html</a> for detailled
          * information regarding the headers in HTML.
          * @param contentDisposition - the content-disposition header. Cannot be
          *            <code>null>/code>.
          * @return the file name, or <code>null</code> if the content-disposition
          *         header does not contain the filename attribute.
         private static final String extractFileNameFromContentDisposition(
                   String contentDisposition) {
              String[] attributes = contentDisposition.split(";");
              for (String a : attributes) {
                   if (a.toLowerCase().contains("filename")) {
                        // The attribute is the file name. The filename is between
                        // quotes.
                        return a.substring(a.indexOf('\"') + 1, a.lastIndexOf('\"'));
              // not found
              return null;
         }

  • How do you get the web application path from the servlet?

    I have created a web application which is installed in
    /webapps/myApplication
    /webapps/myApplication/data/users.xml
    /webapps/myApplication/WEB-INF/classes/myServlet
    How can you get the path to the "users.xml" file from the "myServlet" file?
    The code below doen's seem to return the xml file. anybody knows why?
    public class myServlet extends HttpServlet {
    public void doGet( HttpServletRequest req, HttpServletResponse res ) throws ServletException, IOException
    File myXmlFile = new File("/data/users.xml");

    Try this..
    String FileName = getServletContext().getRealPath("\\data\\users.xml");
    File myXmlFile = new File(FileName);
    hope this helps..

  • Getting the entire file path using "Browse button"

    Hi All,
    I searched the forum for the solution, but did not find it there.
    I am using JFileChooser to browse and select a file.
    then i have to pass this file as and argument to another java program where it reads the file and sends it to the server.
    Now what i actually want is, when the file is selected i want to get the file nam along with the path i.e. C:/temp/temp.doc
    instead i am getting only temp.doc.
    I tried setting the JFileChooser mode as DIRECTORIES_ONLY. But that gives me only C:/temp and not the file name.
    If i set it as FILES_AND_DIRECTORIES it again gives me only the file name and not the path.
    pls. help me. its urgent.
    thanks

    What is wrong with JFileChooser.getSelectedFile()? From the returned File object you can get the canonical name which sounds to be what you want.

  • How Can I get the Jar file path ?

    I have an aplication in a Jar file. This application might be situated in any directory.
    I would like to know programatically the path where it was installed.
    Is there any way to know this simple thing in Java? I cannot believe that there is not a function like System.getProperty("user.dir") for this as System.getProperty("user.dir") will always return the directory from where the Java VM was lauched!
    Thank you!

    You can get the location with:
    URL codeBase = getClass().getProtectionDomain().getCodeBase().getLocation();But as has been pointed out, it's probably better to specify the directory to store these files some other way, e.g. use a batch file or shell script to launch your program and make it the cuirrent directory, or put the directory in as a property or command argument.

Maybe you are looking for

  • Why does one particular website not open on my ipad*,

    Why does one particular website not open on my ipad, when it alwasys did, but the same website is available upstairs on my PC, I'm using the same remote connection but for some reason it doesn't want to open.  I;ve tried refreshing etc... but nothing

  • Scratches on the bottom of my MacBook Pro

    My own carelessness has unfortunately resulted in scratches on the bottom edges of my MacBook Pro. There is also a rather unsightly crack that has appeared from the top right hand corner where the charger connects to the middle section on the bottom

  • Can't Receive Email in Mail from Cloud Since Yesterday ...Anyone?

    Since yesterday, my Mac (OSX Lion) is no longer receiving email from my mac.com email address. My iPhone receives it fine. I tried looking up support articles, but one of the incoming fields in MAIL they want you to set it to is greyed out so I can't

  • Ipod cant find music

    My ipod suddenly won't find my music. I-tunes still has it all, but the computer now won't "mount ipod". The ipod memory shows that there are files still on it. Reset does not help. Last time I ran the battery down, then recharged it and the music ap

  • Are static nested classes thread-safe?

    There doesn't seem to be any definitive answer to this. Given the following code, is it thread-safe? public class SomeMultiThreadedWebController { public HttpServletResponse someMethodToExecuteViaWebRequest(HttpServletRequest request) {     simpleQue