Hi all friends,
Iam facing problem with my uploading programme.My programme working fine when I am uploading file one by one file manually but now I want to put my all files in queue so that it can take file from queue one by one and sends the file to my
servlet for uploading automatically.MY programme scenario is Iam using swing interface for client and for
observing status of uploading Iam using progress monitor my programme is working like by opening file dialog box select all files which I
want to upload to remote server and save it one folder by ziping them .Reading file is done by interface and progress monitored class read
the bytes from interface writes the bytes on output stream and updates the monitor.And now my problem is for taking the file from queue
I put loop on action event on upload button it is taking the file one by one but progress monitor class not writing on outputstream for this
servlet not find the bytes.Below iam pasting only my upload button action code:-
-------------------------------------------------
Upload.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
String path="d:\\Upload1";
String result=null;
String base="http://IP Address/servlet/UploadServlet"; File ff=new File("c:\\Upload");
File[] files = ff.listFiles();
if(files == null)
{
textArea.append("There is no file");
Upload.setEnabled(false);
return;
}
else
{
for (int j = 0 ; j< files.length ; j++)
{
System.out.println("file is :" +files[j]);
result = doSendToServletPart1(base,path,files[j]);
update(xfer,String.valueOf(arg));
}
log(result);
}
}
});
------------------------------------------------------
In doSendToServletPart1() I done my all the file and networking stuff...
update method is below:-
-----------------------
public void update(Observable obs, Object arg)
{
if (obs instanceof ProgressMonitoredDataTransfer && arg != null && uc != null)
{
doSendToServletPart2();
}
}
and in doSendToServletPart2() I done file input reading staff..and close input stream
Can any one plz guide me how I can slove this problem.
Regards
Bikash
:roll:
[ May 27, 2002: Message edited by: Bikash Paul ]