Skip to content

Commit 6c1ea4e

Browse files
committed
Update src/info/sudr/file/UploadServlet.java
manage other parameters from form input fields or formData option see documentation : https://github.com/blueimp/jQuery-File-Upload/wiki/How-to-submit-additional-Form-Data
1 parent 0adf607 commit 6c1ea4e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/info/sudr/file/UploadServlet.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,14 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)
146146
response.setContentType("application/json");
147147
JSONArray json = new JSONArray();
148148
try {
149+
//
150+
// this list is for file items
149151
List<FileItem> items = uploadHandler.parseRequest(request);
152+
//
153+
// this map will contains other parameters from form input fields or formData option
154+
// see documentation : https://github.com/blueimp/jQuery-File-Upload/wiki/How-to-submit-additional-Form-Data
155+
Map<String, String> otherParameters = new HashMap<String, String>();
156+
//
150157
for (FileItem item : items) {
151158
if (!item.isFormField()) {
152159
File file = new File(fileUploadPath, item.getName());
@@ -160,6 +167,12 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)
160167
jsono.put("delete_type", "GET");
161168
json.put(jsono);
162169
}
170+
else {
171+
//
172+
// these are the other form fields or elements of formData option
173+
otherParameters.put(item.getFieldName(), item.getString());
174+
175+
}
163176
}
164177
} catch (FileUploadException e) {
165178
throw new RuntimeException(e);

0 commit comments

Comments
 (0)