I'm doing Web Service and just started yesterday. My knowledge is very shallow because I never learn this before.
I have the code as below
@WebMethod(operationName = "uploadImage")
public String uploadImage(@WebParam(name = "imagePath") String imagePath) {
//TODO write your implementation code here:
try{
File afile =new File(imagePath);
if(afile.renameTo(new File("D:\\" + afile.getName()))){
return "Success";
}else{
return "Failed";
}
}catch(Exception e){
e.printStackTrace();
}
return null;
}
It basically move a file from a directory to another. What I want now is to specify the type of file(s) to be move and I just wanted to move image kind of file (jpg,jpeg,png, etc). How do I specify in my code for it?