i am unable to upload image in my webpage using html and jsp .....plz. help me
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
i am unable to upload image in my webpage using html and jsp .....plz. help me
If you don't understand my answer, don't ignore it, ask a question.
i have used this jsp code:
InputStream in = request.getInputStream(); System.out.println(in.available()); FileOutputStream fos=new FileOutputStream("D:/a.jpg"); int size=1024*1024; byte b[]=new byte[size]; int y=0; while((y=in.read(b))!=-1) { System.out.println(b); if(y==100){fos.write(b); } else { for(int j=0;j<y;j++) fos.write(b[j]); }} response.sendRedirect("rf1.jsp?"); %>
Last edited by curmudgeon; February 9th, 2013 at 12:04 PM. Reason: code tags added.
What errors are thrown? Also, can you format your code so that it is easier to read(i.e. tab things over, comment things out, etc.)?
--- Update ---
And use the code tags when posting chunks of code. You can find them under "Advanced Mode" the "Add Code Tags" button is on the right side, just hover over the buttons until you find it.
--- Update ---
By quickly glancing at your code, it doesn't look like there are any methods, not even the main() method. I believe that in order for any code to execute, it needs to be in a method.