I need to upload a file with servlet. I tested one example of Servertec - File Upload Servlet

  1. It works well but it over writes if the filename already exists
  2. It doesn't provide the solution to restrict the content type e.g. just png,jpg,gif or pdf,doc?
  3. I am trying to get parameters of the rest of the fields to insert into different db table but unable to do

Can you please help me by providing any example/tutorial that solve the file upload problem of above mentioned points

Thanks & best regards