commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Maxime" <>
Subject Re: [FileUpload] - Need to restart each time I upload an Image
Date Sun, 10 Jul 2005 15:07:31 GMT
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 :

            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/";


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

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

                   FileItem item = (FileItem);

                   //   Process a regular form field
                   if (item.isFormField()) {
                   // Have to upgrade and do a better thing
                   if (item.getFieldName().equals("Path"))
                        if (item.getFieldName().equals("Title"))
                        if (item.getFieldName().equals("Desc"))
                        if (item.getFieldName().equals("Price"))
                        if (item.getFieldName().equals("Qty"))



                  // Process a file upload
                  else {

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


                        File uploadedFile = new File("C:\\Program 
Files/Apache Software Foundation/Tomcat 



Thank you


----- Original Message ----- 
From: "Dakota Jack" <>
To: "Jakarta Commons Users List" <>
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 <> 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 
> 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:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message