Hello about FireFox all is ok now,
It's just I have to put file://C:/ and it's work. But for internet things, I will do like that http://localhost:8080/webapps/IMG/image.jpg.
But the problem is I don't want to shutdown tomcat.
When someone upload an image throught a Form, then we can access to this image by a JSP. But it doesn't work, It's look like I have to restart tomcat in order to take this changement (the uploaded Image).

The code is :

try{
           boolean isMultipart = FileUpload.isMultipartContent(request);

              // Create a new file upload handler
              DiskFileUpload upload = new DiskFileUpload();

              // Set upload parameters (must exploit that)
              int  yourMaxMemorySize = 512 * 1024 * 8;
              int  yourMaxRequestSize = 1024 * 1024 * 8;
              String yourTempDirectory = "C:\\TEMPO/";

              upload.setSizeThreshold(yourMaxMemorySize);
              upload.setSizeMax(yourMaxRequestSize);
              upload.setRepositoryPath(yourTempDirectory);

              //Parse the request
              List items = upload.parseRequest(request);

              // Process the uploaded items
              Iterator iter = items.iterator();
              while (iter.hasNext()) {

                  FileItem item = (FileItem) iter.next();

                  //   Process a regular form field
                  if (item.isFormField()) {
                  // Have to upgrade and do a better thing
                  if (item.getFieldName().equals("Path"))
                       {
                           Article.setItemPath(item.getString());
                       }
                       if (item.getFieldName().equals("Title"))
                       {
                           Article.setItemTitle(item.getString());
                       }
                       if (item.getFieldName().equals("Desc"))
                       {
                           Article.setItemDesc(item.getString());
                       }
                       if (item.getFieldName().equals("Price"))
                       {
                           
//Article.setItemPrice(Integer.parseInt(item.getString()));
                           Article.setItemPrice(item.getString());
                       }
                       if (item.getFieldName().equals("Qty"))
                       {
                            Article.setItemQty(item.getString());

                       }

                  }

                 // Process a file upload
                 else {

                       String fieldName = item.getFieldName();
                       String fileName = item.getName();
                       //String contentType = item.getContentType();
                       //boolean isInMemory = item.isInMemory();

                       Article.setItemPath(Article.getItemPath()+"/"+fileName);

File uploadedFile = new File("C:\\Program Files/Apache Software Foundation/Tomcat 5.0/webapps/work/web/IMG/"+Article.getItemPath());

           item.write(uploadedFile);



                 }
}

Thank you

++
Maxime

----- Original Message ----- From: "Dakota Jack" <[EMAIL PROTECTED]>
To: "Jakarta Commons Users List" <[email protected]>
Sent: Sunday, July 10, 2005 3:39 PM
Subject: Re: [FileUpload] - Need to restart each time I upload an Image


There must be something wrong with your code to shut down Tomcat.
What is your code?  Firefox has not difficulties downloading files
including images.

On 7/9/05, Maxime <[EMAIL PROTECTED]> wrote:
Hello,
I made a form where we can upload an Image on the tomcat Server.
But the problem is Tomcat must be restarted in order to take this changement (the uploaded Image). Is there any way or trick to avoid that ? (or some code for automatic restart each time I upload an image). I could define the local path ( C:/..... image.jpg ) , but I don't know why it's doesn't work on FireFox browser (it does work on IE).

I am using windows XP SP 2 for testing the code, Tomcat 5.0.28 and Java 1.5.0.0_4.

Thank you very much !

Maxime



--
"You can lead a horse to water but you cannot make it float on its back."
~Dakota Jack~

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



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

Reply via email to