How to read a client's File system

Hi,
I use a web application where in the client can upload a directory to the server. Then the server should display all the files under that directory by fetching details from the client's disk.
how should this b done with java? Java file system does not allow this. If contents of a single file needs to be read, then it can be sent as multipart form data.
How to read or find out the files under a directory on the client machine?
Thnx in advance

It can be done using the File class used in Java. It can list out directories .
Several methods are available for inspecting an instance of the File class. Some of the important ones are:
Method                                                                                             Purpose
boolean exists()                                   does the file exist?
boolean isFile()                                    is it a file?
boolean isDirectory()                            � or a directory?
String[] list()                                       return the names of all files and directories in a directory
String getName()                                get the file or directory's name
String getPath()                                  get the file or directory's path
These methods are actually all we need in order to find all files and directories in a given directory--all the way down to the last leaves in the directory tree.

Similar Messages

  • How to read some images from file system with webdynpro for abap?

    Hi,experts,
    I want to finish webdynpro for abap program to read some photos from file system. I may make MIMES in the webdynpro component and create photos in the MIMES, but my boss doesn't agree with me using this way. He wish me read these photos from file system.
    How to read some images from file system with webdynpro for abap?
    Thanks a lot!

    Hello Tao,
    The parameter
       icm/HTTP/file_access_<xx>
    may help you to access the pictures without any db-access.
    The following two links may help you to understand the other possibilities as well.
    The threads are covering BSP, but it should be useful for WebDynpro as well.
    /people/mark.finnern/blog/2003/09/23/bsp-programming-handling-of-non-html-documents
    http://help.sap.com/saphelp_sm40/helpdata/de/c4/87153a1a5b4c2de10000000a114084/content.htm
    Best regards
    Christian

  • How to read XML from UNIX file system

    Hi,
    I have this code with read a xml file from windows:
    Document doc = builder.build(new File(C:\\mywork\\src\\Contacts.xml));
    But how can I read the same file from UNIX? (The file is located in "\tmp\Contacts.xml")
    Thanks
    Kenny

    Hi,
    I have this code with read a xml file from windows:
    Document doc = builder.build(new
    File(C:\\mywork\\src\\Contacts.xml));
    But how can I read the same file from UNIX? (The file
    is located in "\tmp\Contacts.xml")
    Thanks
    KennyNo, the file is really located in "/tmp/Contacts.xml". You would writeDocument doc = builder.build(new File("/tmp/Contacts.xml"));Also, your original code would need quotes around the filename too.

  • How to read a whole text file into a pl/sql variable?

    Hi, I need to read an entire text file--which actually contains an email message extracted from a content management system-- into a variable in a pl/sql package, so I can insert some information from the database and then send the email. I want to read the whole text file in one shot, not just one line at a time. Shoud I use Utl_File.Get_Raw or is there another more appropriate way to do this?

    how to read a whole text file into a pl/sql variable?
    your_clob_variable := dbms_xslprocessor.read2clob('YOUR_DIRECTORY','YOUR_FILE');
    ....

  • How do I determine if my file system is case-sensitive before I buy Photoshop CS5?

    How do I determine if my file system is case-sensitive before I buy Photoshop CS5? I currently have Mac OSX 10.5.8 with an Intel Core 2 Duo Processor and 4GB of Memory.. Adobe says the following requirements are needed..
    2GB of available hard-disk space for installation; additional free space required during installation (cannot install on a volume that uses a case-sensitive file system or on removable flash storage devices)
    1024x768 display (1280x800 recommended) with qualified hardware-accelerated OpenGL graphics card, 16-bit color, and 256MB of VRAM
    Some GPU-accelerated features require graphics support for Shader Model 3.0 and OpenGL 2.0
    I don't know if I have a "hardware-accelerated OpenGL graphics card" or "256MB or VRAM".. I've never heard of "VRAM" before and the last bullet points is just as confusing. The last thing I want to do is buy this program and discover my Mac Book is just a tad bit to old for it, I've already done that once with a video game.

    Disk Utility highlighting the drive or partition & clicking the blue Info icon may report it, but since I don't have Case Sensitive I can't tell for sure.
    A simple test would be to save a small txt doc as...
    test
    Then save to the place same as...
    TEST
    If both show on the Disk, then it is, if it asks to replace test with TEST then it isn't.

  • How to read a text/html file in java regardless of its encoding?

    Hi All,
    How to read a text/html file in java regardless of its encoding?
    1. Is there any way to identify that a file (read using FileInputStream/or any other means with java.io package) has been saved with which type of encoding i.e. whether the file is using ANSI encoding or Unicode encoding or other?
    2. Is there any standard way to read an encoded file (i.e. files having UTF-16 format for Asian locales character support) and un-encoded file (i.e. files having ordinary ANSI format) correctly without knowing the user input?
    The problem is that while creating an instance of 'InputStreamReader' (ISR) we can pass the encoding type used (otherwise it takes the system's default encoding type), and the ISR expects the file to be in the same encoding format otherwise it reads it as some junk. But we don't know which file the user is going to pass whether it is Unicode (for Asian locales file should be in Unicode) with or ANSI coded (for non-Asian / English locales user generally uses ANSI encoding).
    Regards,
    Sam

    1. There is no reliable way of guessing the encoding of a file without that information. Thats why XML for example has very strict rules wrt. it's encoding (short form: use UTF-8 or UTF-16, if you use anything else, you'll have to specify it)
    2. you might be able to make an educated guess if the possible range of encodings is limited, but it will probably never be 100% certain
    3. The HTML file might have a header entry "<meta http-equiv..." that tells you about it's encoding. You could try to read the start of the file and see if you find that, then if you found it re-read the entire file.
    regards

  • How to read HyperLinks from pdf file??

    hi developer's,
    I am in PDF processing... I am having doubt in that Processing.
    How to read Hyperlinks from PDF file?
    I can able to set the hyperlink.. But i cant able to get the hyperlinks..
    The following example program will set the hyperlink to the PDF file using lowagie API..
    import com.lowagie.text.Anchor;
    import com.lowagie.text.Chunk;
    import com.lowagie.text.Document;
    import com.lowagie.text.DocumentException;
    import com.lowagie.text.Paragraph;
    import com.lowagie.text.html.HtmlWriter;
    import com.lowagie.text.pdf.PdfReader;
    import com.lowagie.text.pdf.PdfWriter;
    public class Argu1 {
         public static void main(String[] args) {
              Document document = new Document();
              try {
                   PdfWriter pdf = PdfWriter.getInstance(document,
                             new FileOutputStream("PageLink.pdf"));
    PdfReader pdf_read=new                
                   document.open();
                   document.add(new Paragraph("Hi Everbody....!"));
                   Anchor pdfRef = new Anchor("Click Me");
                   pdfRef.setReference("www.java2s.com");
                   Anchor rtfRef = new Anchor("Touch Me");
                   rtfRef.setReference("www.sun.com");
                   System.out.println(rtfRef.reference());
                   document.add(pdfRef);
                   document.add(Chunk.NEWLINE);
                   document.add(rtfRef);
              } catch (DocumentException de) {
                   System.err.println(de.getMessage());
              } catch (IOException ioe) {
                   System.err.println(ioe.getMessage());
              document.close();
    Help me how to read the Hyperlinks from the PDF file using java ...
    Thanks in advance,
    With Regards,
    J.Imran

    Instead of cross-posting unformatted code you could have taken a look at the API, because there you might have come across a method named getLinks...Even though it's not documented, I really suspect that it will return the Hyperlinks on a given page.

  • How to read appended objects from file with ObjectInputStream?

    Hi to everyone. I'm new to Java so my question may look really stupid to most of you but I couldn't fined a solution by myself... I wanted to make an application, something like address book that is storing information about different people. So I decided to make a class that will hold the information for each person (for example: nickname, name, e-mail, web address and so on), then using the ObjectOutputStream the information will be save to a file. If I want to add a new record for a new person I'll simply append it to the already existing file. So far so good but soon I discovered that I can not read the appended objects using ObjectInputStream.
    What I mean is that if I create new file and then in one session save several objects to it using ObjectOutputStream they all will be read with no problem by ObjectInputStream. But after that if in a new session I append new objects they won't be read. The ObjectInputStream will read the objects from the first session after that IOException will be generated and the reading will stop just before the appended objects from the second session.
    The following is just a simple test it's not actual code from the program I was talking about. Instead of objects containing different kind of information I'm using only strings here. To use the program use as arguments in the console "w" to create new file followed by the file name and the strings you want save to the file (as objects). Example: "+w TestFile.obj Thats Just A Test+". Then to read it use "r" (for reading), followed by the file name. Example "+r TestFile.obj+". As a result you'll see that all the strings that are saved in the file can be successfully read back. Then do the same: "+w TestFile.obj Thats Second Test+" and then read again "+r TestFile.obj+". What will happen is that the strings only from the first sessions will be read and the ones from the second session will not.
    I am sorry for making this that long but I couldn't explain it more simple. If someone can give me a solution I'll be happy to hear it! ^.^ I'll also be glad if someone propose different approach of the problem! Here is the code:
    import java.io.*;
    class Fio
         public static void main(String[] args)
              try
                   if (args[0].equals("w"))
                        FileOutputStream fos = new FileOutputStream(args[1], true);
                        ObjectOutputStream oos = new ObjectOutputStream(fos);
                        for (int i = 2; i < args.length ; i++)
                             oos.writeObject(args);
                        fos.close();
                   else if (args[0].equals("r"))
                        FileInputStream fis = new FileInputStream(args[1]);
                        ObjectInputStream ois = new ObjectInputStream(fis);
                        for (int i = 0; i < fis.available(); i++)
                             System.out.println((String)ois.readObject());
                        fis.close();
                   else
                        System.out.println("Wrong args!");
              catch (IndexOutOfBoundsException exc)
                   System.out.println("You must use \"w\" or \"r\" followed by the file name as args!");
              catch (IOException exc)
                   System.out.println("I/O exception appeard!");
              catch (ClassNotFoundException exc)
                   System.out.println("Can not find the needed class");

    How to read appended objects from file with ObjectInputStream? The short answer is you can't.
    The long answer is you can if you put some work into it. The general outline would be to create a file with a format that will allow the storage of multiple streams within it. If you use a RandomAccessFile, you can create a header containing the length. If you use streams, you'll have to use a block protocol. The reason for this is that I don't think ObjectInputStream is guaranteed to read the same number of bytes ObjectOutputStream writes to it (e.g., it could skip ending padding or such).
    Next, you'll need to create an object that can return more InputStream objects, one per stream written to the file.
    Not trivial, but that's how you'd do it.

  • HT1199 I need your help, PLEASE. How can to fix "NO MOUNTABLE FILE SYSTEM" error of my back up hard drive on Mountain Lion OS?

    I need your help, PLEASE. How can to fix "NO MOUNTABLE FILE SYSTEM" error of my back up hard drive on Mountain Lion OS?

    Did you format the drive for Mac use before you tried to use it as a backup drive?
    Are you using Time Machine on the drive? You can't view the contents of its backup database and the only way to access the info is directly from the Time Machine app.

  • How to recover vm host os file system (e.g / ,/boot )

    how to recover vm host os file system (e.g / ,/boot ) from the destroy os ,at the same time ,it dosen't impact other image

    Anybody knows if the source code of scadm tool is available somewhere ? (opensolaris etc. ?)
    I don't have any additional advice to offer other than asking that you to try the flash-update all over again,
    one more time, as if it were the beginning again.Yes but how because the SC is not discovered anymore by Solaris :
    "rmclomv: WARNING: DP_GET_SDP_VERSION failed, ret=4"
    "The SC hardware could not be initialized."
    Can you try to flash the mainalomfw ? Your log contained only the flash of the alombootfw !
    /usr/platform/`uname -i`/sbin/scadm download alommainfw
    I guess jumper JP2 allows to recover from a failed flash by selecting the un-touched half the PROM.It does not work as the SC is not responding anymore to Solaris
    Sun Microsystems Inc. SunOS 5.10 Generic January 2005
    v210:~#
    v210:~# cd /usr/platform/`uname -i`/lib/images
    v210:/usr/platform/SUNW,Sun-Fire-V210/lib/images# /usr/platform/`uname -i`/sbin/scadm download alommainfw
    scadm: The SC hardware could not be initialized.
    v210:/usr/platform/SUNW,Sun-Fire-V210/lib/images#
    ERROR: ERROR: Unable to open the SC device.
    It's a pitty that obtaining OBP/ALOM updates requires a service contract. I got a V210 recently.
    Unfortunately both OBP and ALOM are the intial release 4.8.2 / 1.0.I agree but it's probably also because you need support in case it fails ;-)
    Thanks for your answers!

  • How to read data from a file that was formatted by excel?

    Hi everyone, I'm familiar with java.io and the ability to read from files, can anyone tell me how to read data from a file that was formatted by excel? Or at least give me some web references so that I can learn about it?

    http://jakarta.apache.org/poi/hssf/index.html
    HSSF stands for Horrible Spreadsheet Format, but it still works!

  • How to read list of all files in folder on application server?

    How to read list of all files in folder on application server?

    Hi,
    First get the files in application server using the following function module.
        CALL FUNCTION 'RZL_READ_DIR_LOCAL'
          EXPORTING
            name     = loc_fdir
          TABLES
            file_tbl = int_filedir.
    Here loc_fdir contains the application server path.
    int_filedir contains all the file names in that particular path.
    Now loop at int_filedir.
    OPEN DATASET int_filedir-name FOR INPUT IN TEXT MODE ENCODING  DEFAULT MESSAGE wf_mess.
    MESSAGE wf_mess.
        IF sy-subrc = 0.
          DO.
            READ DATASET pa_sfile INTO wf_string.
            IF sy-subrc <> 0.
              EXIT.
    endif.
    close datset int_filedir-name.
    endloop.

  • How to read text in .kep files

    hey friends,
    how to read text in .kep files
    please help me .
    with regards,
    s.jagadeesh babu

    Hi,
    check this link:
    http://help.sap.com/saphelp_nw04s/helpdata/en/8f/42a293e35011d29b340000e8a4b41d/content.htm
    .kep files are SapShow Training Files. They can be played with sapshow.exe in Knowledge Warehouse.
    SAP Show is KW Viewer Application. You can use it to see “Kep” files. It can be run in windows without the SAP environment. To run SAP Show (4.6D version) you just need 3 files. First is SAP show executable file, another two are “Sapstg.dll” and “ZLib.dll”. You can easily find these files on internet.
    Regards,
    Niraj

  • How to read the whole text file lines using FTP adapter

    Hi all,
    How to read the whole text file lines when error occured middle of the text file reading.
    after it is not reading the remaining lines . how to read the whole text file using FTP adapter
    pls can you help me

    Yes there is you need to use the uniqueMessageSeparator property. Have a look at the following link for its implementation.
    http://download-west.oracle.com/docs/cd/B31017_01/integrate.1013/b28994/adptr_file.htm#CIACDAAC
    cheers
    James

  • How to read a server side file in Applet?

    When I used ZipFile like this,
    ZipFile zf = new ZipFile("http://xxx.com/res.jar");
    It throwed exception about access denied, File pemission...
    How to read a server side file in Applet?

    You generally can't tell with Stream how many bytes are going to be available. You could download the whole thing into a ByteBuffer, for example, and process it from there.
    Or you can try opening an http connection explicitly (using URL and casting the connection to HttpURLConnection and see if there's a "Content-length" header.

Maybe you are looking for

  • How to delete/reverse an A/R Invoice

    Hi How can I delete/reverse an A/R Invoice that has been based on an delivery - without changing/adding the items back to the stock (as the credit memo would handle it) - and reopen the delivery note for future invoicing? The invoice has been posted

  • IDOC and Proxy to R/3 System.

    Hi I am working on a scenario where a file is read and IDOCS are sent to SAP system. My requirement is to create a proxy with a few fields like interface id, wait time and idoc type and trigger the proxy to SAP system as soon as the IDOCS are sent to

  • Using variables in sql scripts

    I am trying to pass a variable into a simple sql script - but each time I run it, it still asks for the variable. Here is my example: test.sql contains: select count(*) from &tbl I try to run it by typing the following at the sqlplus prompt: @test th

  • Reg: syntax error

    hi , when i go with syntax check with method ENRICH_COMPONENT_WITH_ED_DATA in the class interface CL_IM_OIH_MIGO_BADI, got syntax error as: "The line type of the table "CT_GOCOMP" is not compatible with field symbol type "<FS_OIH_GOCOMP>"." pls sugge

  • Captivate controlling FLASH time line

    Please forgive if this question has been asked before. Does anyone know if I can put Actionscipt or javascript into my Captivate project so when my movie ends it controls the timeline in FLASH? I'm importing my Captivate file into a flash file using