I was making a web application using jsp and servlets.In a form i tried to upload a file and enter some value in a textbox.Here is my form :
<FORM METHOD=POST ACTION="sharingfile" NAME="form1" id="form1" enctype="multipart/form-data">   
<INPUT TYPE="file" NAME="file" value="file">  
<INPUT TYPE="text" NAME="totalshares" size="20">  
<INPUT TYPE="submit" value="NEXT"> </FORM>  
And in my sharingfile servlet I wrote following code :
        String N = request.getParameter("totalshares"); 
        ServletFileUpload upload = new ServletFileUpload(new DiskFileItemFactory());
        ArrayList<String>filenamess=new ArrayList<String>();
        List<FileItem> files = new ServletFileUpload(new DiskFileItemFactory()).parseRequest(request);
        out.println(files.size());
        Iterator it=    files.iterator();
        while(it.hasNext()){
        FileItem fi=(FileItem)it.next();
        if (fi.isFormField()) {
            continue;
        }               
        filenamess.add(fi.getName());
        //System.out.println("filename: " + fi.getName());
        InputStream is= fi.getInputStream();
        FileOutputStream fos=new FileOutputStream("C:\\Users\\admin\\Desktop\\SharedCrpto1\\web\\SharedDocuments\\"+fi.getName());
        int x=is.read();
        while(x>=0){
            fos.write((byte)x);
            x=is.read();
            System.out.println("reading");
            }
        }
        out.println(N);
        out.println(filenamess.get(0));
But it give value of N as NULL.What can be the reason ?How to resolve it ?
 
    