I'm facing problem with File Uploading. Im uploading text files.
( Could you please help me.)
- In the source, the part "public class DocData implements Serializable" (the later part of the source), Im having errors in compiling it, specifically in openning the file & converting it to StringBuffer...
- How do I make my file dynamic? Because I just hardcoded the specific file...
Thank you very much....
javeo_lineo
-----------------
//Serializing object..
public class DocData implements Serializable
{
String dataText;
String fName;
String record = null;
int recCount = 0;
void readMyFile()
{
//Read file...
try {
FileReader fr = new FileReader("test.html");
BufferedReader br = new BufferedReader(fr);
record = new String();
while ((record = br.readLine()) != null)
{
//recCount++;
//System.out.print(recCount + ":" + record);
}
}catch (IOException e)
{
//Catch possible io errors from readLine()
System.out.println("Error reading file IOException error!");
e.printStackTrace();
}
br.close();
}
//Write to buffer...
StringBuffer buf = new StringBuffer();
while ((record = fr.readLine()) != null)
{
buf.append(record);
}
DocData data = new DocData();
data.fName = "test.html";
data.dataText = buf.toString();
}