Skip to Content
avatar image
Former Member

File path in URL format?

Hi All,

I have uploaded file to the server in C:
temp folder.

Now I want to get the file path(c:\temp\test.doc) in URL format.

How do I get this?

Thanks

Sundar

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Apr 27, 2007 at 06:04 PM

    Hi,

    take a look at these,

    File file = new File("text.txt");

    String str = file.getAbsolutePath();

    hope it helps

    regards

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 28, 2007 at 10:31 AM

    Hi,

    Try thes steps.hope this will help u.

    File doc = new File("x/y/z.doc");

    doc.getURL();

    Regards,

    Lavanya

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 30, 2007 at 07:20 AM

    use this kind of coding

    URL url1 = new URL("http://localhost:8000/servapp/websites.html");

    URLConnection ucon1 = url1.openConnection();

    System.out.println(ucon1.getContentLength());

    Object obj1 = ucon1.getContent();

    System.out.println(obj1.getClass());

    InputStream is = (InputStream)obj1;

    byte b[] = new byte[10000];

    int i = is.read(b,0,ucon1.getContentLength());

    File f=new File("E:
    htmlfiledown.html");

    FileOutputStream fos=new FileOutputStream(f);

    BufferedOutputStream bos=new BufferedOutputStream(fos);

    int data;

    for(int i1=0;i1<=ucon1.getContentLength()1024;i1+)

    {

    bos.write((char)b[i1]);

    }

    }catch(Exception e)

    {

    }

    }

    }

    Add comment
    10|10000 characters needed characters exceeded