I am trying to uplooad a file and some other fields in jsp the file gets uploaded but the request.getParameter("fieldName") is not working
My HTML Form
<form action="SurveyServlet" id="upload-form" method="post" enctype="multipart/form-data">
  Upload Image
  <input type="file" id="merge_notification" name="merge_notification"  required="required"/>
  <small>Please upload merge notification (Allowed file types are png,jpg)</small>
  Notification Date
  <input type="date" id="merge_notification_date" name="merge_notification_date" required="required"/>
  Remarks
  <textarea id="notification_remarks" name="notification_remarks"></textarea>
  <input type="hidden" id="merging_district" name="merging_district" value="sometest">
  <input type="submit" name="submit_btn" value="Merge School" class="admin-button merge-school-btn">
My Ajaxform Code
<script type="text/javascript">
    $(function () {
         $('#upload-form').ajaxForm({
            success: function(msg) {
            alert(msg);
        },
        error: function(msg) {
            $("#upload-error").text("Couldn't upload file");
        }
    });
    });
Servlet code for file upload
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    processRequest(request, response);
    /*Upload form*/
    if (ServletFileUpload.isMultipartContent(request)) {
        String UPLOAD_DIRECTORY = "c:/mergeSchoolNotifications";
        //Creates the directory if it does not exist in the specified location
        String dest_path = "/" + request.getParameter("merging_district");//create another directory inside
        String savePath = UPLOAD_DIRECTORY + dest_path;
        File uploadDir = new File(UPLOAD_DIRECTORY);
        if (!uploadDir.exists()) {
            uploadDir.mkdir();
        }
        File upload_sub_dir = new File(UPLOAD_DIRECTORY + dest_path);
        if (!upload_sub_dir.exists()) {
            upload_sub_dir.mkdir();
        }
        try {
            List<FileItem> multiparts = new ServletFileUpload(new DiskFileItemFactory()).parseRequest(request);
            for (FileItem item : multiparts) {
                if (!item.isFormField()) {
                    String format = "none";
                    String name = new File(item.getName()).getName();
                    int index = name.lastIndexOf(".");
                    if (index > 0) {
                        format = name.substring(index + 1);
                        format = format.toLowerCase();
                    }
                    item.write(new File(savePath + File.separator + "MyfileName." + format));
                }
            }
            request.setAttribute("message", "uploaded");
        } catch (Exception e) {
            request.setAttribute("message", "File(s) upload failed due to " + e.getMessage() + "!");
        }
    }
    /*Upload form ends here*/
}
The path of the uploaded file is like this C:\mergeSchoolNotifications\null\MyfileName.jpg
My question is how can I dynamically create the subdirectories and then save the path of the uploaded file and some other fields in the sql db
Thanks.
