you can use this code when u Create FileConnection
Code:
// this void when u call it u sent The path Which is it "fileconn.dir.photos" & Send The File Name U want
// U can Change the File name As U want to not replace the other
private void saveFile(String path, String name) {
try {
String url = path + name;
// here i am getting the text from TextBox called txt
byte data[] = txt.getBytes();
FileConnection fconn = (FileConnection)Connector.open(url, Connector.READ_WRITE);
if (!fconn.exists()) {
fconn.create();
}
OutputStream ops = fconn.openOutputStream();
ops.write(data);
ops.close();
fconn.close();
}
catch (IOException ioe) {
System.out.println("IOException: "+ioe.getMessage());
}
catch (SecurityException se) {
System.out.println("Security exception:" + se.getMessage());
}
}
U can Change The name u send to This void which well change the name of txt file Saved
hope it work with u
inform me if not