RE: uploadfile path
html:form method=POST enctype=multipart/form-data html:file property=theFile / /html:form theFile is type of FormFile. You can go from there. -Original Message- From: Daniel Massie [mailto:[EMAIL PROTECTED] Sent: August 6, 2003 2:35 AM To: Struts Users Mailing List Subject: uploadfile path I am trying to upload a file using html:file which is received as a FormFile, the problem is I need to find out this files absolute path. Hwo can I retrieve this information? Thanks Daniel - 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]
RE: uploadfile path
I had a problem using DiskFile when upgrading to 1.1 though. Somehow you cannot convert/cast a FormFile to DiskFile anymore... I think there was a post to dev list about this too. It brings down your production code!!! -Original Message- From: Alok Tijoriwala [mailto:[EMAIL PROTECTED] Sent: August 6, 2003 9:33 AM To: Struts Users Mailing List Subject: Re: uploadfile path Hi Danielle, You will have to use the DiskFile class which implements the FormFile interface. In the struts-config.xml , your controller configuration should be as under: controller processorClass=com.abnamro.waf.struts.WAFRequestProcessor tempDir=/upload maxFileSize=10K multipartClass=org.apache.struts.upload.DiskMultipartRequestHandler set-property property=inputForward value=true/ /controller Regards Alok --- Dan Tran [EMAIL PROTECTED] wrote: Folow the Struts upload example, you can trace thru how Struts gets the client file and upload to server where you have to do extra work to copy data from FormFile (its stream buffer) to the your choice of server location. -Dan - Original Message - From: Yansheng Lin [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Wednesday, August 06, 2003 8:18 AM Subject: RE: uploadfile path html:form method=POST enctype=multipart/form-data html:file property=theFile / /html:form theFile is type of FormFile. You can go from there. -Original Message- From: Daniel Massie [mailto:[EMAIL PROTECTED] Sent: August 6, 2003 2:35 AM To: Struts Users Mailing List Subject: uploadfile path I am trying to upload a file using html:file which is received as a FormFile, the problem is I need to find out this files absolute path. Hwo can I retrieve this information? Thanks Daniel - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - 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]
RE: uploadfile path
Hi Yan, I have been using the DiskFile with struts1.1. Works fine. I would be glad if you can give me more details on the problem. regards Alok --- Yansheng Lin [EMAIL PROTECTED] wrote: I had a problem using DiskFile when upgrading to 1.1 though. Somehow you cannot convert/cast a FormFile to DiskFile anymore... I think there was a post to dev list about this too. It brings down your production code!!! -Original Message- From: Alok Tijoriwala [mailto:[EMAIL PROTECTED] Sent: August 6, 2003 9:33 AM To: Struts Users Mailing List Subject: Re: uploadfile path Hi Danielle, You will have to use the DiskFile class which implements the FormFile interface. In the struts-config.xml , your controller configuration should be as under: controller processorClass=com.abnamro.waf.struts.WAFRequestProcessor tempDir=/upload maxFileSize=10K multipartClass=org.apache.struts.upload.DiskMultipartRequestHandler set-property property=inputForward value=true/ /controller Regards Alok --- Dan Tran [EMAIL PROTECTED] wrote: Folow the Struts upload example, you can trace thru how Struts gets the client file and upload to server where you have to do extra work to copy data from FormFile (its stream buffer) to the your choice of server location. -Dan - Original Message - From: Yansheng Lin [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Wednesday, August 06, 2003 8:18 AM Subject: RE: uploadfile path html:form method=POST enctype=multipart/form-data html:file property=theFile / /html:form theFile is type of FormFile. You can go from there. -Original Message- From: Daniel Massie [mailto:[EMAIL PROTECTED] Sent: August 6, 2003 2:35 AM To: Struts Users Mailing List Subject: uploadfile path I am trying to upload a file using html:file which is received as a FormFile, the problem is I need to find out this files absolute path. Hwo can I retrieve this information? Thanks Daniel - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - 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] __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: uploadfile path
Folow the Struts upload example, you can trace thru how Struts gets the client file and upload to server where you have to do extra work to copy data from FormFile (its stream buffer) to the your choice of server location. -Dan - Original Message - From: Yansheng Lin [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Wednesday, August 06, 2003 8:18 AM Subject: RE: uploadfile path html:form method=POST enctype=multipart/form-data html:file property=theFile / /html:form theFile is type of FormFile. You can go from there. -Original Message- From: Daniel Massie [mailto:[EMAIL PROTECTED] Sent: August 6, 2003 2:35 AM To: Struts Users Mailing List Subject: uploadfile path I am trying to upload a file using html:file which is received as a FormFile, the problem is I need to find out this files absolute path. Hwo can I retrieve this information? Thanks Daniel - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: uploadfile path
Hi Danielle, You will have to use the DiskFile class which implements the FormFile interface. In the struts-config.xml , your controller configuration should be as under: controller processorClass=com.abnamro.waf.struts.WAFRequestProcessor tempDir=/upload maxFileSize=10K multipartClass=org.apache.struts.upload.DiskMultipartRequestHandler set-property property=inputForward value=true/ /controller Regards Alok --- Dan Tran [EMAIL PROTECTED] wrote: Folow the Struts upload example, you can trace thru how Struts gets the client file and upload to server where you have to do extra work to copy data from FormFile (its stream buffer) to the your choice of server location. -Dan - Original Message - From: Yansheng Lin [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Wednesday, August 06, 2003 8:18 AM Subject: RE: uploadfile path html:form method=POST enctype=multipart/form-data html:file property=theFile / /html:form theFile is type of FormFile. You can go from there. -Original Message- From: Daniel Massie [mailto:[EMAIL PROTECTED] Sent: August 6, 2003 2:35 AM To: Struts Users Mailing List Subject: uploadfile path I am trying to upload a file using html:file which is received as a FormFile, the problem is I need to find out this files absolute path. Hwo can I retrieve this information? Thanks Daniel - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: uploadfile path
I had the same requirement to just retrieve the original (client side) file location and not the file itself. This was because I develop strictly for an Intranet (and not trying to get peoples file names unwillingly or anything) and the users had mapped drives to the same shared server. One use would fill out a request asking where a specific file was located on the mapped drive and the other user would fill out a form with the file name only but it was convenient to browse to the file for accuracy. Any these files could literally be a gig in size. With those requirements it meant that the best way was to browse to the file and return only the full path name to the Web/Container server not necessarily the whole file. I assume that is what you want to do? This is what I did: I created two forms on the JSP page. One was a dummy form and the other the real form. The real form was nothing but hidden fields. The submit button for the dummy form (the form you could actually see) was not a submit but a button and it went to a JavaScript method with then did a copy. JavaScript function contents: function submitReal(form1) { form2 = document.forms[1]; form2.personName.vaule = form1.personName.value; form2.file1Name.value = form1.file.value; ... form2.submit(); } Where form2.file1Name was of type html:hidden and form1.file1 was of type html:file. I hope this helps. -Original Message- From: Daniel Massie [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 06, 2003 11:43 AM To: Struts Users Mailing List Subject: RE: uploadfile path its only the original file's location that i require, i can't find any mention of how to aquire this in any online articles. -Original Message- From: Dan Tran [mailto:[EMAIL PROTECTED] Sent: 06 August 2003 16:24 To: Struts Users Mailing List Subject: Re: uploadfile path Folow the Struts upload example, you can trace thru how Struts gets the client file and upload to server where you have to do extra work to copy data from FormFile (its stream buffer) to the your choice of server location. -Dan - Original Message - From: Yansheng Lin [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Wednesday, August 06, 2003 8:18 AM Subject: RE: uploadfile path html:form method=POST enctype=multipart/form-data html:file property=theFile / /html:form theFile is type of FormFile. You can go from there. -Original Message- From: Daniel Massie [mailto:[EMAIL PROTECTED] Sent: August 6, 2003 2:35 AM To: Struts Users Mailing List Subject: uploadfile path I am trying to upload a file using html:file which is received as a FormFile, the problem is I need to find out this files absolute path. Hwo can I retrieve this information? Thanks Daniel - 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] - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: uploadfile path
The way it worked before was that you could specify a FormFile field in your form and cast it to DiskFile right away in your Action class. If you can get hold of an old upload-example.war, you would see the example uses DiskFile, which is totally different from current example. Now you cannot do that anymore. Problem being casting CommonsMultipart to DiskMultipart doesn't work anymore. Now you need an extra step, which is what you posted(a beautiful solution btw, I overlooked:) controller processorClass=com.abnamro.waf.struts.WAFRequestProcessor tempDir=/upload maxFileSize=10K multipartClass=org.apache.struts.upload.DiskMultipartRequestHandler set-property property=inputForward value=true/ /controller -Original Message- From: Alok Tijoriwala [mailto:[EMAIL PROTECTED] Sent: August 6, 2003 9:47 AM To: Struts Users Mailing List Subject: RE: uploadfile path Hi Yan, I have been using the DiskFile with struts1.1. Works fine. I would be glad if you can give me more details on the problem. regards Alok --- Yansheng Lin [EMAIL PROTECTED] wrote: I had a problem using DiskFile when upgrading to 1.1 though. Somehow you cannot convert/cast a FormFile to DiskFile anymore... I think there was a post to dev list about this too. It brings down your production code!!! -Original Message- From: Alok Tijoriwala [mailto:[EMAIL PROTECTED] Sent: August 6, 2003 9:33 AM To: Struts Users Mailing List Subject: Re: uploadfile path Hi Danielle, You will have to use the DiskFile class which implements the FormFile interface. In the struts-config.xml , your controller configuration should be as under: controller processorClass=com.abnamro.waf.struts.WAFRequestProcessor tempDir=/upload maxFileSize=10K multipartClass=org.apache.struts.upload.DiskMultipartRequestHandler set-property property=inputForward value=true/ /controller Regards Alok --- Dan Tran [EMAIL PROTECTED] wrote: Folow the Struts upload example, you can trace thru how Struts gets the client file and upload to server where you have to do extra work to copy data from FormFile (its stream buffer) to the your choice of server location. -Dan - Original Message - From: Yansheng Lin [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Wednesday, August 06, 2003 8:18 AM Subject: RE: uploadfile path html:form method=POST enctype=multipart/form-data html:file property=theFile / /html:form theFile is type of FormFile. You can go from there. -Original Message- From: Daniel Massie [mailto:[EMAIL PROTECTED] Sent: August 6, 2003 2:35 AM To: Struts Users Mailing List Subject: uploadfile path I am trying to upload a file using html:file which is received as a FormFile, the problem is I need to find out this files absolute path. Hwo can I retrieve this information? Thanks Daniel - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - 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] __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - 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]
uploadfile path
I am trying to upload a file using html:file which is received as a FormFile, the problem is I need to find out this files absolute path. Hwo can I retrieve this information? Thanks Daniel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: uploadfile path
its only the original file's location that i require, i can't find any mention of how to aquire this in any online articles. -Original Message- From: Dan Tran [mailto:[EMAIL PROTECTED] Sent: 06 August 2003 16:24 To: Struts Users Mailing List Subject: Re: uploadfile path Folow the Struts upload example, you can trace thru how Struts gets the client file and upload to server where you have to do extra work to copy data from FormFile (its stream buffer) to the your choice of server location. -Dan - Original Message - From: Yansheng Lin [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Wednesday, August 06, 2003 8:18 AM Subject: RE: uploadfile path html:form method=POST enctype=multipart/form-data html:file property=theFile / /html:form theFile is type of FormFile. You can go from there. -Original Message- From: Daniel Massie [mailto:[EMAIL PROTECTED] Sent: August 6, 2003 2:35 AM To: Struts Users Mailing List Subject: uploadfile path I am trying to upload a file using html:file which is received as a FormFile, the problem is I need to find out this files absolute path. Hwo can I retrieve this information? Thanks Daniel - 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] - 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]
RE: uploadfile path
thats exactly what has happened to me, and if i cant cast to DiskFile there isn't much information i can retrieve -Original Message- From: Yansheng Lin [mailto:[EMAIL PROTECTED] Sent: 06 August 2003 16:41 To: 'Struts Users Mailing List' Subject: RE: uploadfile path I had a problem using DiskFile when upgrading to 1.1 though. Somehow you cannot convert/cast a FormFile to DiskFile anymore... I think there was a post to dev list about this too. It brings down your production code!!! -Original Message- From: Alok Tijoriwala [mailto:[EMAIL PROTECTED] Sent: August 6, 2003 9:33 AM To: Struts Users Mailing List Subject: Re: uploadfile path Hi Danielle, You will have to use the DiskFile class which implements the FormFile interface. In the struts-config.xml , your controller configuration should be as under: controller processorClass=com.abnamro.waf.struts.WAFRequestProcessor tempDir=/upload maxFileSize=10K multipartClass=org.apache.struts.upload.DiskMultipartRequestHandler set-property property=inputForward value=true/ /controller Regards Alok --- Dan Tran [EMAIL PROTECTED] wrote: Folow the Struts upload example, you can trace thru how Struts gets the client file and upload to server where you have to do extra work to copy data from FormFile (its stream buffer) to the your choice of server location. -Dan - Original Message - From: Yansheng Lin [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Wednesday, August 06, 2003 8:18 AM Subject: RE: uploadfile path html:form method=POST enctype=multipart/form-data html:file property=theFile / /html:form theFile is type of FormFile. You can go from there. -Original Message- From: Daniel Massie [mailto:[EMAIL PROTECTED] Sent: August 6, 2003 2:35 AM To: Struts Users Mailing List Subject: uploadfile path I am trying to upload a file using html:file which is received as a FormFile, the problem is I need to find out this files absolute path. Hwo can I retrieve this information? Thanks Daniel - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: uploadfile path
as I have said, you need to do extra work to save your upload data to your designated server file. Here is an example ImportForm theForm = (ImportForm) form; FormFile file = theForm.getTheFile(); String fileName= file.getFileName(); String encoding = theForm.getEncoding(); String separator = theForm.getSeparator(); String memberType = theForm.getMemberType(); InputStream inputStream = file.getInputStream(); Charset charset = Charset.forName(encoding); BufferedReader reader = new BufferedReader( new InputStreamReader(inputStream, charset) ); // do your save here -D - Original Message - From: Daniel Massie [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, August 06, 2003 8:57 AM Subject: RE: uploadfile path thats exactly what has happened to me, and if i cant cast to DiskFile there isn't much information i can retrieve -Original Message- From: Yansheng Lin [mailto:[EMAIL PROTECTED] Sent: 06 August 2003 16:41 To: 'Struts Users Mailing List' Subject: RE: uploadfile path I had a problem using DiskFile when upgrading to 1.1 though. Somehow you cannot convert/cast a FormFile to DiskFile anymore... I think there was a post to dev list about this too. It brings down your production code!!! -Original Message- From: Alok Tijoriwala [mailto:[EMAIL PROTECTED] Sent: August 6, 2003 9:33 AM To: Struts Users Mailing List Subject: Re: uploadfile path Hi Danielle, You will have to use the DiskFile class which implements the FormFile interface. In the struts-config.xml , your controller configuration should be as under: controller processorClass=com.abnamro.waf.struts.WAFRequestProcessor tempDir=/upload maxFileSize=10K multipartClass=org.apache.struts.upload.DiskMultipartRequestHandler set-property property=inputForward value=true/ /controller Regards Alok --- Dan Tran [EMAIL PROTECTED] wrote: Folow the Struts upload example, you can trace thru how Struts gets the client file and upload to server where you have to do extra work to copy data from FormFile (its stream buffer) to the your choice of server location. -Dan - Original Message - From: Yansheng Lin [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Wednesday, August 06, 2003 8:18 AM Subject: RE: uploadfile path html:form method=POST enctype=multipart/form-data html:file property=theFile / /html:form theFile is type of FormFile. You can go from there. -Original Message- From: Daniel Massie [mailto:[EMAIL PROTECTED] Sent: August 6, 2003 2:35 AM To: Struts Users Mailing List Subject: uploadfile path I am trying to upload a file using html:file which is received as a FormFile, the problem is I need to find out this files absolute path. Hwo can I retrieve this information? Thanks Daniel - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - 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] - 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]