2012-09-23 57 views
0

爲了得到HTTP直接鏈接到文件鏈接(與NAME延長) 像http://website.com/file.avi可以用JAVA:HTTP URL上獲取文件名與文件ID

URL FileLocation = new URL("string"); 
String Name = FileLocation.getFile(); 

來完成這將與延長(/filename.ext)

但返回NAME如何到g等名對於網址用php ID喜歡

http:///website.com/download.php?d=9594 

我只想爲此在JAVA。

+0

你想得到什麼? '9594'? –

+0

檢查[this](http://stackoverflow.com/questions/12250258/12252255#12252255)鏈接。 –

回答

0
File file=new File("C:/work/chandan/deepak.txt"); 
    URL url=null; 
.... 
.... 

url=file.toURL(); //file:/C:/work/chandan/deepak.txt 
System.out.println("The url is" + url);