You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Frances <fd...@yahoo.com> on 2005/05/01 07:28:31 UTC

[FileUpload] commons.io-error.... ??

Hello, I'm just starting out w/jak.commons.FileUpload..

I'm running a bunch of Tomcat webapps successfully, both locally on my 
Windows machine (Tomcat 5.0.27) and at server where my website is.. 
(Tomcat 5.0.25) w/o having to change any code in any of them.. (even one 
that connects to a MySQL db, each on their respective servers..) 
however, just got started w/j.c.FileUpload, and even though I have 
followed directions to the letter as they appear here

www.onjava.com/pub/a/onjava/2003/06/25/commons.html?page=3

and deployed the app w/o having changed anything at all in 
fileuploaddemo.jsp, and have same HTML form as shown in this example, 
files simply don't get uploaded..  I don't get errors, get to where I'm 
supposed to get after req gets processed, but files don't get uploaded, 
and well, not even sure where to look for them..  what exactly does this 
line do?

    File savedFile = new File(getServletContext().getRealPath("/"), 
fullFile.getName());

does this path take me to root of app? or where? (b/c uploaded files 
don't show up there or anywhere else w/in app..)

(I looked up getRealPath() in Servlet API, it says, "Returns a String 
containing the real path for a given virtual path."
pls, what is meant by "given virtual path"?)  would appreciate any 
help.. thank you very much...  Frances



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [FileUpload] commons.io-error... working now, still have one q..

Posted by Frances <fd...@yahoo.com>.
ok, now this is working, this is weird, I did not change anything, and 
now files are uploading fine..

they upload to wherever I tell it to..  either

          File savedFile = new
  File(getServletContext().getRealPath("/"), fullFile.getName());

or

       File savedFile = new
File(getServletContext().getRealPath("/images"), fullFile.getName());

what I do want to know now is how to upload more than one file at a 
time, i.e., when you click on "browse" in file input field and get to 
"choose file" dialogue, is it possible to write code so you can select 
more than one file at a time?  thank you very much..  Frances



Frances wrote:
> Dakota Jack wrote:
> 
>> Just look at the String returned and you will see what the answer is. 
>> Sorry for being so direct, but this how simple an answer to your
>> question is.
> 
> 
> what string?  this one..
> 
>              File savedFile = new 
> File(getServletContext().getRealPath("/"), fullFile.getName());
> ?
> if I do
> 
>         out.println(fullFile);  // or
>     out.println(savedFile);
> 
> I get a "can't resolve symbol" error.. actually I can't print anything 
> at all on this page, even a simple test string ( out.println("test"); )
> why is he sending strings to be printed to a separate page..  (msg.jsp) 
>  why doesn't anything print on this page..  this is frustrating, can't 
> trouble-shoot if nothing on this page prints..... :(
> 
> thank you again..  Frances
> 
> 
>> On 4/30/05, Frances <fd...@yahoo.com> wrote:
>>
>>> Hello, I'm just starting out w/jak.commons.FileUpload..
>>>
>>> I'm running a bunch of Tomcat webapps successfully, both locally on my
>>> Windows machine (Tomcat 5.0.27) and at server where my website is..
>>> (Tomcat 5.0.25) w/o having to change any code in any of them.. (even one
>>> that connects to a MySQL db, each on their respective servers..)
>>> however, just got started w/j.c.FileUpload, and even though I have
>>> followed directions to the letter as they appear here
>>>
>>> www.onjava.com/pub/a/onjava/2003/06/25/commons.html?page=3
>>>
>>> and deployed the app w/o having changed anything at all in
>>> fileuploaddemo.jsp, and have same HTML form as shown in this example,
>>> files simply don't get uploaded..  I don't get errors, get to where I'm
>>> supposed to get after req gets processed, but files don't get uploaded,
>>> and well, not even sure where to look for them..  what exactly does this
>>> line do?
>>>
>>>    File savedFile = new File(getServletContext().getRealPath("/"),
>>> fullFile.getName());
>>>
>>> does this path take me to root of app? or where? (b/c uploaded files
>>> don't show up there or anywhere else w/in app..)
>>>
>>> (I looked up getRealPath() in Servlet API, it says, "Returns a String
>>> containing the real path for a given virtual path."
>>> pls, what is meant by "given virtual path"?)  would appreciate any
>>> help.. thank you very much...  Frances
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>>
>>>
>>
>>
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [FileUpload] commons.io-error.... ??

Posted by Frances <fd...@yahoo.com>.
Dakota Jack wrote:
> Just look at the String returned and you will see what the answer is. 
> Sorry for being so direct, but this how simple an answer to your
> question is.

what string?  this one..

	         File savedFile = new 
File(getServletContext().getRealPath("/"), fullFile.getName());
?
if I do

         out.println(fullFile);  // or
	out.println(savedFile);

I get a "can't resolve symbol" error.. actually I can't print anything 
at all on this page, even a simple test string ( out.println("test"); )
why is he sending strings to be printed to a separate page..  (msg.jsp) 
  why doesn't anything print on this page..  this is frustrating, can't 
trouble-shoot if nothing on this page prints..... :(

thank you again..  Frances


> On 4/30/05, Frances <fd...@yahoo.com> wrote:
> 
>>Hello, I'm just starting out w/jak.commons.FileUpload..
>>
>>I'm running a bunch of Tomcat webapps successfully, both locally on my
>>Windows machine (Tomcat 5.0.27) and at server where my website is..
>>(Tomcat 5.0.25) w/o having to change any code in any of them.. (even one
>>that connects to a MySQL db, each on their respective servers..)
>>however, just got started w/j.c.FileUpload, and even though I have
>>followed directions to the letter as they appear here
>>
>>www.onjava.com/pub/a/onjava/2003/06/25/commons.html?page=3
>>
>>and deployed the app w/o having changed anything at all in
>>fileuploaddemo.jsp, and have same HTML form as shown in this example,
>>files simply don't get uploaded..  I don't get errors, get to where I'm
>>supposed to get after req gets processed, but files don't get uploaded,
>>and well, not even sure where to look for them..  what exactly does this
>>line do?
>>
>>    File savedFile = new File(getServletContext().getRealPath("/"),
>>fullFile.getName());
>>
>>does this path take me to root of app? or where? (b/c uploaded files
>>don't show up there or anywhere else w/in app..)
>>
>>(I looked up getRealPath() in Servlet API, it says, "Returns a String
>>containing the real path for a given virtual path."
>>pls, what is meant by "given virtual path"?)  would appreciate any
>>help.. thank you very much...  Frances
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>
>>
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [FileUpload] commons.io-error.... ??

Posted by Dakota Jack <da...@gmail.com>.
Just look at the String returned and you will see what the answer is. 
Sorry for being so direct, but this how simple an answer to your
question is.



On 4/30/05, Frances <fd...@yahoo.com> wrote:
> Hello, I'm just starting out w/jak.commons.FileUpload..
> 
> I'm running a bunch of Tomcat webapps successfully, both locally on my
> Windows machine (Tomcat 5.0.27) and at server where my website is..
> (Tomcat 5.0.25) w/o having to change any code in any of them.. (even one
> that connects to a MySQL db, each on their respective servers..)
> however, just got started w/j.c.FileUpload, and even though I have
> followed directions to the letter as they appear here
> 
> www.onjava.com/pub/a/onjava/2003/06/25/commons.html?page=3
> 
> and deployed the app w/o having changed anything at all in
> fileuploaddemo.jsp, and have same HTML form as shown in this example,
> files simply don't get uploaded..  I don't get errors, get to where I'm
> supposed to get after req gets processed, but files don't get uploaded,
> and well, not even sure where to look for them..  what exactly does this
> line do?
> 
>     File savedFile = new File(getServletContext().getRealPath("/"),
> fullFile.getName());
> 
> does this path take me to root of app? or where? (b/c uploaded files
> don't show up there or anywhere else w/in app..)
> 
> (I looked up getRealPath() in Servlet API, it says, "Returns a String
> containing the real path for a given virtual path."
> pls, what is meant by "given virtual path"?)  would appreciate any
> help.. thank you very much...  Frances
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
> 


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

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [FileUpload] commons.io-error.. -- sorry wrong subject line..

Posted by Frances <fd...@yahoo.com>.
Frances wrote:
> Hello, I'm just starting out w/jak.commons.FileUpload..
> 
> I'm running a bunch of Tomcat webapps successfully, both locally on my 
> Windows machine (Tomcat 5.0.27) and at server where my website is.. 
> (Tomcat 5.0.25) w/o having to change any code in any of them.. (even one 
> that connects to a MySQL db, each on their respective servers..) 
> however, just got started w/j.c.FileUpload, and even though I have 
> followed directions to the letter as they appear here
> 
> www.onjava.com/pub/a/onjava/2003/06/25/commons.html?page=3
> 
> and deployed the app w/o having changed anything at all in 
> fileuploaddemo.jsp, and have same HTML form as shown in this example, 
> files simply don't get uploaded..  I don't get errors, get to where I'm 
> supposed to get after req gets processed, but files don't get uploaded, 
> and well, not even sure where to look for them..  what exactly does this 
> line do?
> 
>    File savedFile = new File(getServletContext().getRealPath("/"), 
> fullFile.getName());
> 
> does this path take me to root of app? or where? (b/c uploaded files 
> don't show up there or anywhere else w/in app..)
> 
> (I looked up getRealPath() in Servlet API, it says, "Returns a String 
> containing the real path for a given virtual path."
> pls, what is meant by "given virtual path"?)  would appreciate any 
> help.. thank you very much...  Frances

sorry, wrong subject line is b/c first I had uploaded this jar, 
commons-fileupload-1.1-dev.jar, b/c that's what is says in Vikram 
Goyal's article to dl (which is diff. from what you dl if you dl from 
jakarta.apache site, namely commons-fileupload-1.0.jar..) w/the dev.jar 
I was getting common.io error, and realized in the middle of writing 
post that maybe I should go back and dl jar I had dl'd originally, 
before I read Vikram Goyal's article...;)  and I did, and no longer get 
that commons.io error (but forgot to change subject line..;)..)
ok sorry, this is still confusing to me, as I said am just starting out 
w/jak.commons.FileUpload..  bottom line is right now no longer get that 
error but files still don't get uploaded..  thank you again.. Frances



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org