GETTING ABSOLUTE FILE PATH IN FLEX

Hi,
I am Facing 2 issues in Flex..
1) I am not able to import
flash.fileSystem
in my MXML Application
2) Is it possible to get path of file using fileReference. I
want the path of the selected file
Can someone please help !!!

There is no way the Flash Player will open a local file for
you. Keep in mind that the Flash Player was designed and developed
for web application - those apps which are served remotely with the
intention of keeping the data on a server. If you wanted to upload
your image onto a server, that's fine.
If you want to store files locally, please look into Adobe
Apollo. You'll still get to use Flex and Flex Builder. The result
will be a desktop application with an easy-to-use, operating system
independent, way to read and write local files.

Similar Messages

  • How to get absolute File Path using JFileChooser?

    Hi,
    IS there any way by which we can get the absolute file path ? e.g. If I browse thro JFileUser and Selects "a.txt" and say open, it should return me the complete file
    path e.g. D:/abc/a.txt.
    Present method.fileChooser.getSelectedFile().getName() return the name of the file i.e. a.txt and NOT the complete path.
    Pls Help !!

    fileChooser.getSelectedFile().getAbsolutePath(); will do the trick.

  • How to get full file path while uploading a file in flex Applications

    How to get full file path while uploading a file in flex applications.
    FileReference Object is giving file name and other details but not the actual path.
    Is there any workaround to to get the file path?.
    Thanks

    Why not ask in the Flex forum; it is more likely that someone over there knows.

  • Getting absolute file name using af:inputFile

    Hi all,
    Can you help me how to get absolute file name (e.g., C:\Documents\file.txt) using <af:inputFile> component or using any another JSF component.
    Thanks in advance :)))

    we can't get absolute path using inputFile, we can get only the file name. as per my knowledge we don't have any other component also.
    i have one of my requirement i need to read file from specified folder, so i have hard coded my folder name in my managed bean.

  • How to get the file path from HTML input form in Firefox3

    In IE7 (and probably all famous browsers, including old Firefox 2), if we submit a file like 'C:\folder1\folder2\folder3\filename' it works properly and gives the full path to the file and the filename.
    In Firefox 3, it returns only 'filename', because of their new 'security feature' to truncate the path, as explained in Firefox bug tracking system (https://bugzilla.mozilla.org/show_bug.cgi?id=143220)
    I have no clue how to overcome this 'new feature'.
    Can anyone help to find a single solution to get the file path both on Firefox 3 and IE7?
    Thanks in advance....

    Doubleposted and ignored any previous answer: [http://forums.sun.com/thread.jspa?threadID=5342405]. Don't do that. It's rude.
    Regarding to your "problem": why do you need the file path?

  • How to get the file path from HTML input form in Firefox 3...

    In IE7 (and probably all famous browsers, including old Firefox 2), if we submit a file like 'C:\folder1\folder2\folder3\filename' it works properly and gives the full path to the file and the filename.
    In Firefox 3, it returns only 'filename', because of their new 'security feature' to truncate the path, as explained in Firefox bug tracking system (https://bugzilla.mozilla.org/show_bug.cgi?id=143220)
    I have no clue how to overcome this 'new feature' because it causes all upload forms in my webapp to stop working on Firefox 3.
    Can anyone help to find a single solution to get the file path both on Firefox 3 and IE7?
    Thanks in advance....

    As you're posting this in the JSF forum and looking at your [previous topic|http://forums.sun.com/thread.jspa?threadID=5342365], I assume that you're using Tomahawk's t:inputFileUpload. In this case, just use UploadedFile#getInputStream(). You may find this article useful: [http://balusc.blogspot.com/2008/02/uploading-files-with-jsf.html].
    By the way, are you lazy or just dumb? You wasted one week to this! I've posted the aforementioned article one week ago. How did you stuck?

  • Function module to get the file path in the system for TEMP folder

    Hi All,
    Is there any function module that I can use to get the file path in the system for TEMP folder.
    I mean, i am supposed to give only TEMP as the input for that function module and I need to get the path of that in the system as the output.
    I am unsing 4.0 version.
    Please advice.
    Regards
    Ramesh

    In Higher versions, we can use the below code:
    call method CL_GUI_FRONTEND_SERVICES=>ENVIRONMENT_GET_VARIABLE
        exporting
          VARIABLE   = 'TEMP'
        importing
          VALUE      = LV_TMP
        exceptions
          CNTL_ERROR = 1
          others     = 2.
      if SY-SUBRC <> 0.
        message id SY-MSGID type SY-MSGTY number SY-MSGNO
        with SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
      call method CL_GUI_CFW=>FLUSH
        exceptions
          CNTL_SYSTEM_ERROR = 1
          CNTL_ERROR        = 2
          others            = 3.
      if SY-SUBRC <> 0.
    Error handling
      endif.
      concatenate lv_tmp '\' into folder_path.
    But need to know in the lower versions like 3.1h and 4.0,

  • How to get physical file path from logical file path

    Hi
    there is a immediate requirement ,
    I have logical file path but I need to get physical file path from it.
    So is there any FM which providesthis functionality.
    Points will be rewarded.
    Thanks

    Can you please share the piece of code ?
    Which File APIs are you using ?
    For java file, you can get complete path by simple method call : getAbsolutePath() on file object.
    Regards,
    Ashwani Kr Sharma

  • How Do I get a File Path from a FileName?

    Hi there,
    I was wondering how do i get a file path(i.e) directory only from a file name.
    Say i got a file called "C:\Test.txt" is there a method in java that will allow me to only get "C:\"?
    I've tried getPath(), getAbsolutePath() and they all return the directory and the file itself.
    Please Help
    James

    String path = file.getPath();
    String name = file.getName();
    int i=0;
    for(i=0; i< (path.length()-name.lenth() ); i++){
    String temp = path.substring(i, i+name.length());
    if(temp.equals(name) break;
    return path.substring(0,i);

  • Absolute file path in a war file

    Hi,
    I have a war file which I have deployed on a Weblogic 7 server.I have a startup servlet which tries to read an xml file located in the WEB-INF folder.I need to have the absolute path to the file so that my parser can read the xml file.
    ServletContext.getRealPath() returns null when the application is in a war format.
    Would be grateful for any help.
    regards
    Vikram

    I've been using the getRealPath() method from the
    ServletContext object to ..
    I'm suspicious of the fact that
    you are getting a null pointer when you use
    getRealPath().
    I have also been deploying my webapps to Tomcat using
    war files. So without knowing more I'm guessing you
    may have some sort of problem with your overall
    configuration here...Nothing to do with configuration. getRealPath() returns null if the .war file doesn't get unpacked. The Tomcat servlet engine unpacks the war files but weblogic apparently does not.
    So getRealPath() is not generic enough, as it depends on the servlet container used.
    Also, I would not recommend the suggestion to use the ProtectionDomain.getCodeSource() method (although it may work). ProtectionDomain is not intended for reading xml files, (wether inside the web-inf dir or not) but has to do with security. It is simply overkill in this case.
    The poster should be able to get the file with the class.getResource() method, get a java.net.URL obj out of it, then call URL.getPath() or getFile() (check the URL class for these methods ), get back a path string and call his parser.
    The other way would be to simply list that file in the web.xml as an init param :
    <context-param>
    <param-name>filename</param-name>
    <param-value>WEB-INF/file.xml</param-value>
    </context-param>and get it with
    getInitParameter("filename")

  • How do I get a file path from my Document?

    Hi,
    I encountered a very strange problem with absolute and relative file paths.
    Getting to the point:
    Myfolder ---> MainPage.pdf
    Subfolder---> Project.pdf
    SubsubFolder ---> Search.pdf
    So we have Myfolder with the Mainpage.pdf  , from there I use a bookmark to go the Subfodler and use bookamarks to browse throu the Project.pdf and then I go even deeper when i want to use the search.query to get items from the Search.pdf which is in the Subsubfolder
    So my path looks like:
    Ofc the search type is boolean
    search.query("MyTxt","Folder","../Myfolder/Subfolder/Subsubfolder");
    And here's the problem - it does not work on every computer.
    So the question is, how can i get the filepath from MainPage and use it in my search.query to avoid this problem?
    Any suggestions are welcome!

    You can use the "split" method of the  string object to get the path into an an array and then combine all but the last element.
    // get full path and file name
    var cPath = this.path;
    // split ful path into an arrayl
    var aPath = cPath.split("/");
    // build the directory path
    var cDir = "";
    // loop through the array omitting first and last elements
    for(i = 1; i < aPath.length - 1; i++) {
    cDir = cDir + "/" + aPath[i];
    } // end of building directory path
    console.println("Directory path: " + cDir);

  • How to get absolute directory path of a resource?

    Hi,
      I wished to retrieve the absolute directory path of a resource, for example, "demo.test" in the folder of "/document/personal". How to I get the value "/document/personal", is there any IPropertyName i could use?
    Thanks for any suggestions.

    Hi,
    first, the accessRID is the RID which was used at creation time, maybe containing links; these are resolved, so you will get the "physical" place where the file is stored by <i>getRID</i>.
    Second, to determine the path without the name of the file, there are at least three possibilities without looping (resource, the file, is an instance of IResource):
    1.) String path = resource.getParentCollection().getRID().toString();
    2.) String path = resource.getRID().toString().substring(0, resource.getRID()().toString().lastIndexOf('/'));
    3.) String path = resource.getRID()().toString().substring(0, resource.getRID()().toString().length() - resource.getName().length());
    Solution 1 seems to be very intuitive (you ask for the folder path, where the file is in), 2 & 3 are shorter than a loop, but not intuitive and in general dangerous (when using substring, you have to take care of exceptions caused by strange parameters).
    Hope it helps
    Detlev

  • How to get the file path in adf application

    hii all,
    i have a txt file that i am using in my adf application,
    i am passing this txt file through a File Reader, for which i have to mention the file path.
    The file is in web-content and when i am hard coding the complete file path i.e C:/JDeveloper/myApp/ViewController/public_html/log.txt
    the application is working fine when run on integrated weblogic server.
    My requirement is to access this file without giving the static file path, as in case i have to use this application on any other machine..
    for that how to mention the file path-
    i tried using FacesContext to get the context path :-
    FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath();
    which gives me
    \myApp-ViewController-context-root
    after appending public_html\log.txt
    I am using the following path to access the file :-
    \myApp-ViewController-context-root\public_html\log.txt
    again i am getting the java.io.FileNotFoundException
    Does anyone know how to use file from inside the web-content without giving the complete path..???
    Thanks

    Hi,
    If you put your file under public_html folder, you can use this code to access the file:
    For example file is : log.txt
    FacesContext.getCurrentInstance().getExternalContext().getRealPath('/log.txt').toString().trim();
    Thanks.
    - LSR

  • Issue with Getting the file path from InputFile component

    Hi,
    One of our requirement is like below:
    I am working on ADF 11g (latest release R1) page. User will select the file and when he/she clicks on the Save button we need to store the file path in the database.
    In the database file_path is varchar2(300). We need to store just the file path. I am using InputFile component but filepath is not getting inserted.
    This is really urgent. It would be really appreciate if anyone can guide me on this.
    Thanks
    MC

    Hi Mahesh,
    I have manage to store the file path from the InputFile component in Jdev 11g. I found the file upload script from this forum and manage to alter it so that i could save the file path to the database. But my problem is to retrieve it back to view as a document. Hope this will help you :)
    This is an example of what I have manage to save to my DB :
    (CLOB) //192.168.238.53/c$/Research/Docs/0906160744/EyeCandyLog.txt
    In my form, I save the file path first before I update the other fields. My code is something like this :
    public void uploadFile(ValueChangeEvent valueChangeEvent) {
    // Add event code here...
    InputStream in;
    FileOutputStream out;
    if(tanda == 0){
    try {
    // final Context context = getInitialContext();
    RS01Proposal rS01Proposal = (RS01Proposal)new InitialContext().lookup("Phase2-RS01Proposal#sr.model.RS01Proposal");
    id = rS01Proposal.dptProposalid();
    tanda = tanda + 1;
    System.out.println("tanda"+ tanda);
    } catch (Exception ex) {
    ex.printStackTrace();
    System.out.println("id"+id);
    proposal = id.substring(6);
    System.out.println("proposal"+proposal);
    UploadedFile file = (UploadedFile)valueChangeEvent.getNewValue();
    String fileUploadLoc = "//192.168.238.53/c$/Research/Docs/"+id+"/";//The place where file will saved
    //create upload directory
    boolean exists = (new File(fileUploadLoc)).exists();
    if (!exists) {
    (new File(fileUploadLoc)).mkdirs();
    if (file != null && file.getLength() > 0) {
    FacesContext context = FacesContext.getCurrentInstance();
    FacesMessage message =
    new FacesMessage("File Uploaded " + file.getFilename() +
    " (" + file.getLength() + " bytes)");
    *// extracting the file message to get the path*
    context.addMessage(valueChangeEvent.getComponent().getClientId(context), message);
    columnL = valueChangeEvent.getComponent().getClientId(context);
    column = columnL.substring(9);
    System.out.println(column);
    columnLengkap = "RS01"+column.toUpperCase();
    System.out.println("columnLengkap"+columnLengkap);
    *try {*
    out = new FileOutputStream(fileUploadLoc + "" + file.getFilename());
    in = file.getInputStream();
    *for (int bytes = 0; bytes < file.getLength(); bytes++) {*
    out.write(in.read());
    in.close();
    out.close();
    } catch (IOException e) {
    e.printStackTrace();
    } else {
    String filename = file != null ? file.getFilename() : null;
    String byteLength = file != null ? "" + file.getLength() : "0";
    FacesContext context = FacesContext.getCurrentInstance();
    FacesMessage message =
    new FacesMessage(FacesMessage.SEVERITY_WARN, " " + " " +
    filename + " (" + byteLength + " bytes)",
    null);
    context.addMessage(valueChangeEvent.getComponent().getClientId(context),
    message);
    System.out.println(fileUploadLoc+file.getFilename());
    a = fileUploadLoc+file.getFilename();
    b = b + 1;
    if (flagInsert == 0){
    try {
    // final Context context = getInitialContext();
    RS01Proposal rS01Proposal = (RS01Proposal)new InitialContext().lookup("Phase2-RS01Proposal#sr.model.RS01Proposal");
    rS01Proposal.insertDoc(id,proposal,columnLengkap,a);
    flagInsert = flagInsert + 1;
    System.out.println("tanda"+ tanda);
    //session
    ProposalSession.storeCurrentProposalId(id);
    } catch (Exception ex) {
    ex.printStackTrace();
    }else{
    // update proses
    try {
    // final Context context = getInitialContext();
    RS01Proposal rS01Proposal = (RS01Proposal)new InitialContext().lookup("Phase2-RS01Proposal#sr.model.RS01Proposal");
    rS01Proposal.updateDoc(id,proposal,columnLengkap,a);
    flagInsert = flagInsert + 1;
    //session
    ProposalSession.storeCurrentProposalId(id);
    System.out.println("tanda"+ tanda);
    } catch (Exception ex) {
    ex.printStackTrace();
    }

  • How to get Sequence file path In "Sequentia​lModel.Seq​"?

    Hello
    I need to get the sequence file path in "SequentialModel.seq" before the "GetReportoptions" Callback is called.
    I found that step "Determine Report File Path" in "Sequenctialmodel.seq" returns the sequence file path but i.e after executing quite a series of steps.
    i need to get  this sequence file path in the starting of "SequentialModel.seq".
    looking forward to hear from you
    Thanks n Regards
    Kulwant

    Hello Kulwant,
    try "RunState.InitialSelection.SelectedFile.Path" or "RunState.ProcessModelClient.Path" at the beginning of SequentialModel.seq please.
    Regards
    MY

Maybe you are looking for