I have tried to upload a photo using the code
driver.findElement(By.xpath("xpath")).sendKeys("C:\\Users\\path\\ben.jpg");
But the image is not getting uploaded.
The html of the upload button is
<button id="upfile1" class="buttonclass" style="cursor: pointer" type="button"> Choose Photo</button>
Is there any other way to upload image. I have tried using WebElement also. I need a solution in JAVA.