• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help Needed Urgently: File Upload help Required

 
Declan Conlon
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anyone know how to determine the ammount of data that has been tranferred to a server once the applet has written its byte[] to a DataOutputStream. I thought DataOutputStream.size() would work but it only returns the size of the byte[] not the ammout of data transferred to the server. The calculation/determination must be done client side.
Could anyone help me out of a hole here? Thanks for all of your help.
 
Bipul Bhattacharjee
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Declan,
Think u want to know the size of the file.Make an instanse of your data stream in to a file and u can easily get the size of the file.
fis = new FileInputStream(source);
File file=new File(source);
long filesz=file.length();
Bipul

 
Declan Conlon
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No I need to get the actual length of the data being transferred to the servlet, not a static filesize.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the total data isn't too big you can build your DataOutputStream from a ByteArrayOutputStream. When everything has been written you can look at the resulting byte[] size before actually sending it.
Bill

------------------
author of:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic