suprapto45
asked on
File Upload
Hi,
I am using Tomcat 5.5. If my clients give me the list of files in his machine, is there any way we can upload the file to server (Tomcat 5.5)? Preferably, the uploading is in the same request. I will try to google it later on but I currently am too busy with other things.
If you can provide me with the URL, that would be good.
David
I am using Tomcat 5.5. If my clients give me the list of files in his machine, is there any way we can upload the file to server (Tomcat 5.5)? Preferably, the uploading is in the same request. I will try to google it later on but I currently am too busy with other things.
If you can provide me with the URL, that would be good.
David
You need to use an applet to upload several files at a time (unless you use multiple upload form elements)
http://www.jupload.biz/
http://www.jupload.biz/
you can't return mutltiple file in one request response
use a servlet that zips up the required files and returns the zip to th e the client.
use a servlet that zips up the required files and returns the zip to th e the client.
ASKER
Sorry CEHJ and objects
I just returned to office. Basically, without the fileupload like <input type="file"..>, is there any other way we can put the file into request?
David
I just returned to office. Basically, without the fileupload like <input type="file"..>, is there any other way we can put the file into request?
David
ASKER
I was looking at the possibility using XmlHttpRequest but no luck. Another option is using ADODB.Stream of Microsoft but I do not want to do that ;) - I think you all know why.
David
David
You could use a POST request, but then you would have to zip them
ASKER
Thanks CEHJ,
>>"You could use a POST request"
but without using tbe <input type="file"..> within the <form></form>. Is it possible to send it to request by POST?
David
>>"You could use a POST request"
but without using tbe <input type="file"..> within the <form></form>. Is it possible to send it to request by POST?
David
Well i was thinking more of having no form at all (if that's acceptable)
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi CEHJ,
That is acceptable. But I still can't think of any way to put this *stream* of file to POST. Can you share your idea?
David
That is acceptable. But I still can't think of any way to put this *stream* of file to POST. Can you share your idea?
David
ASKER
Hi girionis,
Thanks for your comments. That is a good suggestion but I prefer to have a look at what I am discussing with CEHJ first. If that is not possible then I would go for your suggestion ;).
David
Thanks for your comments. That is a good suggestion but I prefer to have a look at what I am discussing with CEHJ first. If that is not possible then I would go for your suggestion ;).
David
Yeap, no problem. If you decide to go with my suggestion and you also want some help with the JavaScript let me know and I will do my best :)
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That is interesting. Let me try that out CEHJ
David
David
ASKER
I am just getting a little *blur*
// data would be key1=value1
String data = URLEncoder.encode("key1", "UTF-8") + "=" + URLEncoder.encode("value1" , "UTF-8");
If the value1 is supposed to be the *stream* of the file uploaded instead of String. What would happen there as data is String?
David
// data would be key1=value1
String data = URLEncoder.encode("key1", "UTF-8") + "=" + URLEncoder.encode("value1"
If the value1 is supposed to be the *stream* of the file uploaded instead of String. What would happen there as data is String?
David
ASKER
>>"What would happen there as data is String?"
What should we do?
David
What should we do?
David
> What would happen there as data is String?
It should be the same, just use one of the other methods that write the data as stream.
It should be the same, just use one of the other methods that write the data as stream.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Correction:
>>Enumeration<?> enum = Collections.enumeration(fi les);
should have been
Enumeration<FileInputStrea m> enum = Collections.enumeration(fi les);
>>Enumeration<?> enum = Collections.enumeration(fi
should have been
Enumeration<FileInputStrea
Another correction (i'm a bit tired ;-)):
that will concatenate the files. Just do a normal ZipFile and add entries
that will concatenate the files. Just do a normal ZipFile and add entries
ASKER
Thanks
I will have a try on it
David
I will have a try on it
David
ASKER
Excellent. Thanks everyone. I think that I have grabbed the concept now ;).
David
David
:-)
:)
Isn't that what I suggested oiriginally, what exactly did u decide to use?
ASKER
Sorry objects,
I just read my mail. Well, I decided to use the combination of FileUpload, HttpClient of the Jakarta Common as well as the suggestion of CEHJ. I have not yet implemented it as this project happens in the coming weeks. However, I may not use the zip as I was thinking of some other alternatives.
I have to say that all the concepts are here ;).
David
I just read my mail. Well, I decided to use the combination of FileUpload, HttpClient of the Jakarta Common as well as the suggestion of CEHJ. I have not yet implemented it as this project happens in the coming weeks. However, I may not use the zip as I was thinking of some other alternatives.
I have to say that all the concepts are here ;).
David
ASKER
We can't really use the fileupload component as the number of files are not fixed.
David