there are 2 ways to upload a file
1.)driver.get("http://qtpselenium.com/test/uploadform/contactform.php");
driver.findElement(By.xpath("//*[@id='photo']")).sendKeys("C:\\maximize.png");
but this doesn't always work.
so, second method is used.
2.)click on choose file with selenium and then call auto it via java.