473,395 Members | 1,941 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

MultipartRequest

oll3i
679 512MB
i try to upload a file using MultipartRequest
i want to get the name of the file uploaded with html form
and display it on jsp page (just for now to see if it works)
in server.log i see Error creating file: java.io.IOException: Corrupt form data: premature ending
code i use and it doesnt work
Expand|Select|Wrap|Line Numbers
  1.  try
  2. {
  3. MultipartRequest mrequest = new MultipartRequest(request, filesSavePath);
  4. Enumeration files = mrequest.getFileNames();
  5.  
  6. for (int i = 1; files.hasMoreElements( );i++)
  7.     p= mrequest.getFilesystemName((String) files.nextElement( ));
  8.  
  9.  
  10.  
  11. }
  12. catch(Exception ex)
  13. {
  14. System.out.println("Error creating file: " + ex );
  15. }
  16.  
thank You
Jan 11 '09 #1
3 3558
r035198x
13,262 8TB
What's the code for your form?
Jan 12 '09 #2
oll3i
679 512MB
Expand|Select|Wrap|Line Numbers
  1.     <form action="faces/result.jsp" method="POST" enctype="multipart/form-data">
  2.       <input type="file" name="cv" value="" width="50" />
  3.       <input type="submit" value="Wyślij" />
  4.       </form>
  5.  
Jan 12 '09 #3
r035198x
13,262 8TB
Why are you submitting to a JSP instead of to a servlet? Read the manual provided at apache's commons-fileupload site to see how it's supposed to be done.
Jan 13 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: cv | last post by:
Hello All, I have used MultipartRequest like the following to upload images. MultipartRequest multi = new MultipartRequest(request, "../webapps/coreprogram/dealerlogos", 1024 * 1024); It...
6
by: jajoo | last post by:
Hi, I have a problem with using *.jar files with Tomcat 5.0.16. I place the jar in the lib directory of the application but server throws Exception. java.lang.NoClassDefFoundError:...
1
by: jajoo | last post by:
Hi everyone, I am trying to send files with multipart/form-date. Everything is ok with the send. But when I am receiving the files I should specify a directory where the files to be saved. The...
1
by: John C. Wallace | last post by:
I have written a Java application that will upload files and fields to a MultipartRequest servlet. However, I now need to do the same in C++. Although very similar, I do not know how to go about...
6
dmjpro
by: dmjpro | last post by:
Have a look at my HTML Code and my Java code. I m trying to see the total contents when a form is submitted with enctype=multipart/form-data. <html> <head> <title>Simple File Upload...
2
by: praveenkumarvpk | last post by:
Hi friends Please help me! Following is my servlet-code import java.util.Enumeration; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import...
1
by: shyaminf | last post by:
hi everybody! iam facing a problem with the transfer of file using servlet programming. i have a code for uploading a file. but i'm unable to execute it using tomcat5.5 server. kindly help me how to...
0
by: akaley | last post by:
Hi All, Iam using MultiPartRequest class(cos.jar) for Reading the file comtent from Client Machine. My coding is working without any problem in My local system.But in testing server it causes...
1
by: akaley | last post by:
Hi All, My system file upload functionality..iam storing file content in DataBase by using Blob data type. But my problem is MultipartRequest is automaticlly store the file in tomcat/bin...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.