• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Is there any way to do check how many files the user have uploaded?

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
I am quite new to jsp and I want to ask for advice.
I have a form as below in multiUpload.html for users to upload files:
<form action="multi_action.jsp" enctype="MULTIPART/FORM-DATA" method="post">
Select file1 to upload <input type="file" name="filename1"><br>
Select file2 to upload <input type="file" name="filename2"><br>
Select file3 to upload <input type="file" name="filename3"><br>
Select file4 to upload <input type="file" name="filename4"><br>
Select file5 to upload <input type="file" name="filename5"><br>
<input type="submit" value="Upload"><br>
</form>
In the page multi_action.jsp, i use the following code but cannot check how many files the user have uploaded, no is null when print out.
<%
String files;
int fileCnt = 1;
int no = 0;
While (fileCnt < 6) {
files = request.getParameter("filename" + fileCnt);
if (files!=null) {
no++;
}
fileCnt++;
}
out.println("no: " + no);
%>
Is there any way to do check how many files the user have uploaded?
thx for advice.
ypc
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic