Upload and Download files just like attachments in JSP
Kaushal Pandya
Greenhorn
Joined: Feb 15, 2006
Posts: 9
posted
0
Hi everyone, I am using JSP as a front-end view purpose, From this page I have to push the data to one of the Action Request System form (AR System 6.3). I am using ARS JAVA API. As per requirement I have to upload one file from user on JSP and have to push it to this back-end form. I tried JavaZoom�s javazoom.upload class but its giving me a error and I couldn�t fine this class file anywhere. So this code didn�t work finally. I need a urgent solution friends. Please respond with some positive solutions. Thank you, Kaushal.
Hai Ben, i am using common file upload by jakarta to yupload file from client side to server i am having error while doing so....Can anyone solve the problem Error : org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 7 in the jsp file: /ProcessFileUpload.jsp Generated servlet error: ServletFileUpload cannot be resolved to a type
An error occurred at line: 7 in the jsp file: /ProcessFileUpload.jsp Generated servlet error: ServletFileUpload cannot be resolved to a type
An error occurred at line: 7 in the jsp file: /ProcessFileUpload.jsp Generated servlet error: FileItemIterator cannot be resolved to a type
An error occurred at line: 7 in the jsp file: /ProcessFileUpload.jsp Generated servlet error: FileItemStream cannot be resolved to a type
An error occurred at line: 7 in the jsp file: /ProcessFileUpload.jsp Generated servlet error: InputStream cannot be resolved to a type
An error occurred at line: 7 in the jsp file: /ProcessFileUpload.jsp Generated servlet error: StreamUtil cannot be resolved
[BPSouther: Added UBB Code tags] [ November 28, 2006: Message edited by: Ben Souther ]
jothish
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35241
7
posted
0
ServletFileUpload is in package org.apache.commons.fileupload.servlet, which is not imported (org.apache.commons.fileupload is imported twice).
The other missing classes are not part of Commons FileUpload API, AFAICT, and need to be imported as well.
The import statement is also missing a comma at "java.util.Iteratorjava.io.*".
My advice would be to handle file uploads in a servlet, not a JSP. It will be much easier to handle the upload logic and error cases, and then dispatch to one or more JSP pages depending on the outcome. [ November 27, 2006: Message edited by: Ulf Dittmer ]
[BPSouther: Added UBB CODE tags] [ November 28, 2006: Message edited by: Ben Souther ]
jothish chokkalingam
Ranch Hand
Joined: Jan 02, 2006
Posts: 50
posted
0
Hai error message for the above code: HTTP Status 404 - d:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\ROOT\uploaded\new.xml (The system cannot find the path specified)
jothish chokkalingam
Ranch Hand
Joined: Jan 02, 2006
Posts: 50
posted
0
it is working fine ppl i have created a folder to put the file
jothish chokkalingam
Ranch Hand
Joined: Jan 02, 2006
Posts: 50
posted
0
One more thing pandya Can i upload zip file using the above code..... Any ideas and suggestions please provide me.....
Kaushal Pandya
Greenhorn
Joined: Feb 15, 2006
Posts: 9
posted
0
Hey jothish, as far as i tested it... it will work for any kind of file. .doc, .xls, .zip. etc... if you have any problem do contact me regarding it.
If you are going to post more than a line or two of your code, wrap that code in a set of UBB Code tags. Doing so will help to preserve your code's indenting, making it easier to read. If it is easier to read, more people will actaully read it and you will stand a better chance of getting help with your question. See UseCodeTags for more help with UBB code tags.
Kaushal Pandya
Greenhorn
Joined: Feb 15, 2006
Posts: 9
posted
0
Thanks Ben, will keep this in mind. thank you once again.
jothish chokkalingam
Ranch Hand
Joined: Jan 02, 2006
Posts: 50
posted
0
Ppl, One more thing downloading a csv file from server i am facing a problem... My pice of code to throw output to browser Is this the way to do this....?
For the above code i am getting the output stream from browser not the expected one it is throwing with error message stating couldn't read the file