hello all..
I am trying to upload a file to our server. My code works properly with small sized files, but it is giving problem while uploading a larger sized files. its giving "java/lang/OutOfMemoryError." error. I suppose if there is any restriction in the size that we upload the data in our "GFC" after debuging i think it may be "ByteArrayOutputStream" which is making problem, i am not sure. so please can anybody tel me are there any restrictions as such.
my code is like this..
InputStream input = fileConnection.openInputStream();
ByteArrayOutputStream out = new ByteArrayOutputStream();
int read;
byte[] buffer = new byte[1024];
while ((read = input.read(buffer,0,1024)) != -1) {
out.write(buffer, 0, read);
}
System.out.println("after while.......");
byte[] data = out.toByteArray();
input.close();
// all works fine but if larger file selected then memory error comes before the "after while" print statement. ( also i am not getting exact file size limit, i am able to send 3 MB of data.. but file size of 5MB is not been sent..

Reply With Quote


