wood burning stoves 2.0*
The moose likes JSP and the fly likes File upload Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "File upload" Watch "File upload" New topic
Author

File upload

Jherald Lacambra
Ranch Hand

Joined: Feb 02, 2005
Posts: 129
Is there a java class that can upload files to the server using only the path of the file. I am using jsp.


jherald
Jon Emerson
Greenhorn

Joined: Feb 19, 2006
Posts: 5
Do you want to upload files to a server or to receive files uploaded to you by web clients? If you're uploading files to a server, do you need to upload via an HTTP POST, or can you use FTP or some other protocol?
[ February 20, 2006: Message edited by: Jon Emerson ]

Jon Emerson<br /> <a href="http://www.jonemerson.net" target="_blank" rel="nofollow">http://www.jonemerson.net</A>
Jherald Lacambra
Ranch Hand

Joined: Feb 02, 2005
Posts: 129
do you need to upload via an HTTP POST, or can you use FTP or some other protocol?<----


via http post.. im using the multi-part form data. I want to call a class file or some method and pass the path of the file from the client's workstation. The class file should be able to upload the said document's using only the path of the file. Is it possible?
Chetan Parekh
Ranch Hand

Joined: Sep 16, 2004
Posts: 3636
Still not clear to me.

You will be sending a file path from the client to server using post method and on server there will be a class that take file path and get fetch from the client.

Or

You are sending file content using multi-part option and you want to save that content in a path specified by the client.


My blood is tested +ve for Java.
Jherald Lacambra
Ranch Hand

Joined: Feb 02, 2005
Posts: 129
You will be sending a file path from the client to server using post method and on server there will be a class that take file path and get fetch from the client. <-- this is the correct one. So the file path would be a string and the server will fetch the file use that string
Chetan Parekh
Ranch Hand

Joined: Sep 16, 2004
Posts: 3636
Originally posted by Jherald Lacambra:
You will be sending a file path from the client to server using post method and on server there will be a class that take file path and get fetch from the client. <-- this is the correct one. So the file path would be a string and the server will fetch the file use that string


Well server can�t fetch file just like that.

You have only one option: Server is getting file using FTP from client. But you need to configure FTP at client end. If you are developing web based application, you can�t handle that as anybody can access from anywhere using any platform.

But tell me, what is the business logic behind server fetching the file from client and not client sending file using multi-part?
Jherald Lacambra
Ranch Hand

Joined: Feb 02, 2005
Posts: 129
Actually i have file uploading jar using the multi-form and works fine. My systems analyst told me that i should get only the file path of the document to be uploaded so that even if i change/go to other pages of the application i still can upload the said file.
Chetan Parekh
Ranch Hand

Joined: Sep 16, 2004
Posts: 3636
Originally posted by Jherald Lacambra:
Actually i have file uploading jar using the multi-form and works fine. My systems analyst told me that i should get only the file path of the document to be uploaded so that even if i change/go to other pages of the application i still can upload the said file.


Jherald Lacambra technically is not possible unless you use FTP option and physically this option is also not achievable as yours is a web based application and anybody can access from anywhere.

Anybody correct me if I am wrong.
Jherald Lacambra
Ranch Hand

Joined: Feb 02, 2005
Posts: 129
Thanks for the reply
Chetan Parekh
Ranch Hand

Joined: Sep 16, 2004
Posts: 3636
Your System Analyst asked for the different solution may because when user uploads file, it is taking too much time and user is not able to browse thru other links of the site � until upload activity finished. If user clicks on other links on the site while upload is in progress, upload get cancelled and user need to upload file again.

System Analyst is looking for the solution where upload is independent process. User can upload the file and while upload is in process, user can go perform other tasks too. Ask if this is what he is looking for.

If, yes, when user clicks on upload module, open that module in a popup - rather than the current window. Popup will handle entire uploading routine, while user can navigates thru the other links on the site in the parent window.
Jherald Lacambra
Ranch Hand

Joined: Feb 02, 2005
Posts: 129
Yeah the popup window is what i actually did. from the form[1] i open a popup window which will carry the file for uploading. once the form[1] of the mother window is submited the child window will be submited too. this is fine. the problem is after submission, there will be data validation using the data on our database, so the data submitted in the do not exist in the database the page should go to an errorpage with form[2] so that the user can edit what he/she has entered previously. the file goes to the server because it is the child submitted. the only controller of the child window is the window with the first form[1]. My SA ask me is to treat the file like string like it can be pass into session, or if not the file path(that is a string) can be pass into session. if the form[2] with errors has been successfully submited with no errors on validation , then the files for upload will only go to the server.. that is what he want me to do in the application
 
wood burning stoves
 
subject: File upload