01: /*
02: * $Id: MultipleFileUploadUsingArrayAction.java 478625 2006-11-23 17:31:52Z wsmoak $
03: *
04: * Licensed to the Apache Software Foundation (ASF) under one
05: * or more contributor license agreements. See the NOTICE file
06: * distributed with this work for additional information
07: * regarding copyright ownership. The ASF licenses this file
08: * to you under the Apache License, Version 2.0 (the
09: * "License"); you may not use this file except in compliance
10: * with the License. You may obtain a copy of the License at
11: *
12: * http://www.apache.org/licenses/LICENSE-2.0
13: *
14: * Unless required by applicable law or agreed to in writing,
15: * software distributed under the License is distributed on an
16: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17: * KIND, either express or implied. See the License for the
18: * specific language governing permissions and limitations
19: * under the License.
20: */
21: package org.apache.struts2.showcase.fileupload;
22:
23: import java.io.File;
24:
25: import com.opensymphony.xwork2.ActionSupport;
26:
27: /**
28: * Showcase action - mutiple file upload using array.
29: *
30: * @version $Date: 2006-11-23 12:31:52 -0500 (Thu, 23 Nov 2006) $ $Id: MultipleFileUploadUsingArrayAction.java 478625 2006-11-23 17:31:52Z wsmoak $
31: */
32: public class MultipleFileUploadUsingArrayAction extends ActionSupport {
33:
34: private File[] uploads;
35: private String[] uploadFileNames;
36: private String[] uploadContentTypes;
37:
38: public File[] getUpload() {
39: return this .uploads;
40: }
41:
42: public void setUpload(File[] upload) {
43: this .uploads = upload;
44: }
45:
46: public String[] getUploadFileName() {
47: return this .uploadFileNames;
48: }
49:
50: public void setUploadFileName(String[] uploadFileName) {
51: this .uploadFileNames = uploadFileName;
52: }
53:
54: public String[] getUploadContentType() {
55: return this .uploadContentTypes;
56: }
57:
58: public void setUploadContentType(String[] uploadContentType) {
59: this .uploadContentTypes = uploadContentType;
60: }
61:
62: public String upload() throws Exception {
63: System.out.println("\n\n upload2");
64: System.out.println("files:");
65: for (File u : uploads) {
66: System.out.println("*** " + u + "\t" + u.length());
67: }
68: System.out.println("filenames:");
69: for (String n : uploadFileNames) {
70: System.out.println("*** " + n);
71: }
72: System.out.println("content types:");
73: for (String c : uploadContentTypes) {
74: System.out.println("*** " + c);
75: }
76: System.out.println("\n\n");
77: return SUCCESS;
78: }
79:
80: }
|