Date: 2005-03-02T13:07:26
Editor: DakotaJack
Wiki: Apache Struts Wiki
Page: StrutsUpload
URL: http://wiki.apache.org/struts/StrutsUpload
no comment
Change Log:
------------------------------------------------------------------------------
@@ -91,49 +91,48 @@
{{{
public class UploadMultipartFile
implements MultipartFile {
- private String fileContentType;
- private String fileName;
- private long fileSize;
+ private String contentType;
+ private String name;
+ private long size;
private FileItem fi;
public UploadMultipartFile() {
}
- public UploadMultipartFile(FileItem fi) {
- this.fi = fi;
+ public UploadMultipartFile(String name,
+ String contentType,
+ long size) {
+ this.name = name;
+ this.contentType = contentType;
+ this.size = size;
}
- public UploadMultipartFile(String fileName,
- String fileContentType,
- long fileSize) {
- this.fileSize = -1L;
- this.fileName = fileName;
- this.fileContentType = fileContentType;
- this.fileSize = fileSize;
+ public UploadMultipartFile(FileItem fi) {
+ this.fi = fi;
}
public long getSize() {
- return fileSize;
+ return size;
}
- public void setSize(long fileSize) {
- this.fileSize = fileSize;
+ public void setSize(long size) {
+ this.size = size;
}
public String getName() {
- return fileName;
+ return name;
}
- public void setName(String fileName) {
- this.fileName = fileName;
+ public void setName(String name) {
+ this.name = name;
}
public String getContentType() {
- return fileContentType;
+ return contentType;
}
- public void setContentType(String fileContentType) {
- this.fileContentType = fileContentType;
+ public void setContentType(String contentType) {
+ this.contentType = contentType;
}
public byte[] getData() {
@@ -141,12 +140,12 @@
if(is != null) {
int i = (int)getSize();
if(i > 0) {
- byte streamData[] = new byte[i];
+ byte data0[] = new byte[i];
try {
- is.read(streamData);
+ is.read(data0);
is.close();
} catch(IOException ioe) { }
- return streamData;
+ return data0;
} else {
return null;
}
@@ -156,8 +155,9 @@
}
public void reset() {
- if(this.fi != null)
- this.fi.delete();
+ if(fi != null) {
+ fi.delete();
+ }
}
public InputStream getInputStream() {
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]