| Author |
take in file from client machine
|
Azrael Noor
Ranch Hand
Joined: Jul 29, 2010
Posts: 369
|
|
i am trying to take file from client machine in server
What to do is?
1) in text box take file path
2) send file path to servlet
3) now?
am i getting wrong or not?
|
Regards
Azrael Noor
|
 |
Jan Cumps
Bartender
Joined: Dec 20, 2006
Posts: 2343
|
|
|
We have a FileUpload faq on the JavaRanch.
|
OCUP UML fundamental
ITIL foundation
|
 |
Azrael Noor
Ranch Hand
Joined: Jul 29, 2010
Posts: 369
|
|
i am not getting where to make the directory
private static final String DESTINATION_DIR_PATH ="/files";
now where should i make this folder?
|
 |
subhash kumar
Ranch Hand
Joined: Jul 14, 2010
Posts: 63
|
|
i am not getting where to make the directory
private static final String DESTINATION_DIR_PATH ="/files";
now where should i make this folder?
save the uploaded file(from client) at some central location for example can be file server
or
make some folder on server machine that will always be available and can be treated as file repository with read write permission.
|
Subhash Kumar
Attitude is everything
|
 |
Azrael Noor
Ranch Hand
Joined: Jul 29, 2010
Posts: 369
|
|
ok now
i have make folder in c: drive
C:\files
Now i have changed that portion of code accordingly
When i try to upload the file
i get beautiful error again and i.e
|
 |
subhash kumar
Ranch Hand
Joined: Jul 14, 2010
Posts: 63
|
|
make sure that folder c:\files directory should exist
and this directory also should have the writing permission
can you post your code how are you accessing this directory.
|
 |
Azrael Noor
Ranch Hand
Joined: Jul 29, 2010
Posts: 369
|
|
this way i am using code
|
 |
subhash kumar
Ranch Hand
Joined: Jul 14, 2010
Posts: 63
|
|
|
try using other drives like f:\\files
|
 |
Azrael Noor
Ranch Hand
Joined: Jul 29, 2010
Posts: 369
|
|
)
|
 |
Seetharaman Venkatasamy
Ranch Hand
Joined: Jan 28, 2008
Posts: 5575
|
|
|
could *jnlp* help you?
|
 |
subhash kumar
Ranch Hand
Joined: Jul 14, 2010
Posts: 63
|
|
you are not throwing the real path which you are using check it first.
|
 |
subhash kumar
Ranch Hand
Joined: Jul 14, 2010
Posts: 63
|
|
use here realPath in place of DESTINATION_DIR_PATH
your exception is misleading you because file object is created by realPath but ServletException is thrown by DESTINATION_DIR_PATH
|
 |
Azrael Noor
Ranch Hand
Joined: Jul 29, 2010
Posts: 369
|
|
1 Error is much better than more than one
|
 |
Azrael Noor
Ranch Hand
Joined: Jul 29, 2010
Posts: 369
|
|
giving whole code
Code in Servlet
in html
|
 |
subhash kumar
Ranch Hand
Joined: Jul 14, 2010
Posts: 63
|
|
provide your application this class any how.
|
 |
Tom Thomas
Greenhorn
Joined: Jun 23, 2003
Posts: 2
|
|
The call uploadHandler.parseRequest(request) fails - I get the error that my request is not multipart/form-data.
My jsp:
<form action="attachments" method="post" name="files" enctype="multipart/form-data" >
.....
<input type="file" id="dataFile" name="datafile" size="80" accept="image/gif, image/jpeg, image/png, image/jpg">
....
</form>
When I call request.getContentType, null is returned. It doesn't seem that the header is being set by the enctype parameter.
Any ideas?
|
 |
 |
I agree. Here's the link: jrebel
|
|
subject: take in file from client machine
|
|
|