hi...
im trying to upload file (audio file *.wav) from mobile to server. i'm using HttpConnenction. my file are on local device so i'm using fileconnection to. can anyone help me?? i'm really need this code, please help me...:confused:

this my script
Java Code:
 try{
            System.out.println("url:" + URL);
            conn = (HttpConnection)Connector.open(URL, Connector.WRITE);
            conn.setRequestMethod(HttpConnection.POST);
			conn.setRequestProperty("User-Agent", "Profile/MIDP-2.0 Configuration/CLDC-1.1");
            String postData = "";

            //InputStream imgIs = getClass().getResourceAsStream(FILE);

//fileconnection
            Enumeration e = FileSystemRegistry.listRoots();
			String root = (String)e.nextElement();
			//String filename = "file:///" +root + FILE;
			String filename ="file:///root/audio.wav";
			FileConnection fc = (FileConnection)Connector.open(filename, Connector.READ);
			// FileConnection fc1 = (FileConnection) Connector.open("file:///tmp/audio.wav",Connector.READ);
			//InputStream imgIs = fc.openInputStream();
			//InputStream imgIs = (InputStream)fc.openInputStream();
			//InputStream imgIs = (InputStream)imgIs1.openInputStream();
			//ByteArrayOutputStream baos = new ByteArrayOutputStream();
			//writeFileInBaos(baos);
			//os.write(baos.toByteArray());
			
			
			byte []imgData = new byte[imgIs.available()];
            imgIs.read(imgData);

            String message1 = "";
            message1 += "-----------------------------4664151417711" + CrLf;
            message1 += "Content-Disposition: form-data; name=\"uploadedfile\"; filename=\"" + FILE + "\"" + CrLf;
            message1 += "Content-Type: audio/wav" + CrLf;
            message1 += CrLf;

            // the image is sent between the messages ni the multipart message.

            String message2 = "";
            message2 += CrLf + "-----------------------------4664151417711--" + CrLf;               

            conn.setRequestProperty("Content-Type", "multipart/form-data; boundary=---------------------------4664151417711");
            // might not need to specify the content-length when sending chunked data.
            // conn.setRequestProperty("Content-Length", String.valueOf((message1.length() + message2.length() + imgData.length)));

            System.out.println("open os");
            os = conn.openOutputStream();
			//writeFileInBaos(baos);
            System.out.println(message1);
            os.write(message1.getBytes());
			//os.write(message1.toByteArray());

            // SEND THE IMAGE
            int index = 0;
            int size = 10240;
            do{
                System.out.println("write:" + index);
				System.out.println("size :" + imgData.length);
                if((index+size)>imgData.length){
                    size = imgData.length - index; 
                }
                os.write(imgData, index, size);
                index+=size;
                //progress(imgData.length, index); // update the progress bar.

            }while(index<imgData.length);
            System.out.println("written:" + index);            

            System.out.println(message2);
            os.write(message2.getBytes());
            os.flush();

            System.out.println("open is");
            is = conn.openInputStream();

            char buff = 512;
            int len;
            byte []data = new byte[buff];
            do{
                System.out.println("READ");
                len = is.read(data);

                if(len > 0){
                    System.out.println(new String(data, 0, len));
                }
            }while(len>0);

            System.out.println("DONE");