Hi,
I am modifying the upload files given by struts and trying to upload the
file to server without the user entering any path.

I have modified the upload.jsp with
<html:text property="filePath" value="/upload/images" />

Its means I am trying to upload to the same context in which the jsp is
running (webapps/test/upload/images)

I have modified the UploadAction.java as

                //else {
                    //write the file to the file specified
                    String filePath = theForm.getFilePath();
                    System.out.println("filePath:"+filePath);
                    String fileName2 = filePath+"/"+fileName;
                    System.out.println("fileName2:"+fileName2);
                    OutputStream bos = new FileOutputStream(fileName2);
                    int bytesRead = 0;
                    byte[] buffer = new byte[8192];
                    while ((bytesRead = stream.read(buffer, 0, 8192)) != -1)
{
                        bos.write(buffer, 0, bytesRead);
                    }
                    bos.close();
                    data = "The file has been written to \"" +
theForm.getFilePath() + "\"";
                //}

I get this output too
filePath:/upload/images
fileName2:/upload/images/test.jpg

I do not have any error the page just becomes blank and the file is not
uploaded. Any ideas?

Uma


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to