0
Can someone help me on jsp file uploading
i want to create a directory and uplaod a file inside the directory using MultipartRequest but i could not able to get the directory values from the url because request.getParameter() is not working and first i want to get the values from the url then add it to path then upload it.
1 Respuesta
0
Hope it helps
private static String UPLOADED_FOLDER = "src//main//webapp//Product Images//";
public Product addProduct(MultipartFile productImage)
{
try {
byte[] imageInByte = productImage.getBytes();
Path path = Paths.get(UPLOADED_FOLDER + productImage.getOriginalFilename());
Files.write(path, imageInByte);
}
catch(Exception e)
{
e.printStackTrace();
}