Date: 2005-03-07T11:44:13 Editor: DakotaJack Wiki: Apache Struts Wiki Page: StrutsUpload URL: http://wiki.apache.org/struts/StrutsUpload
no comment Change Log: ------------------------------------------------------------------------------ @@ -495,7 +495,7 @@ public InputStream getInputStream() throws IOException { - if(!this.uos.isInMemory()) { + if(!uos.isInMemory()) { return new FileInputStream(uos.getFile()); } @@ -523,7 +523,7 @@ return (long)data.length; } - if(this.uos.isInMemory()) { + if(uos.isInMemory()) { return (long)uos.getData().length; } else { return uos.getFile().length(); @@ -536,6 +536,7 @@ data = uos.getData(); } + StdOut.log("log.devel","UploadFileItem uos.isInMemory() data = " + data); return data; } @@ -652,12 +653,11 @@ uos = new UploadOutputStream(threshold, outputFile, monitors, isFormField()); - if(this.monitors != null && !isFormField()) { - for(int i = 0; i < monitors.size(); i++) { - Monitor monitor = (Monitor)monitors.get(i); - monitor.init(outputFile, totalSize, getContentType()); + if(monitors != null && !isFormField()) { + Iterator iter = monitors.iterator(); + while(iter.hasNext()) { + ((Monitor)iter.next()).init(outputFile, totalSize, getContentType()); } - } } return this.uos; @@ -993,13 +993,13 @@ } FileOutputStream fos = null; - String uploadFileName = null; + String overwriteFileName = null; if(!isSameName) { fos = new FileOutputStream(getStoreLocation() + UploadConstant.SEPARATOR + uploadFile.getName()); } else if(!overwrite) { - uploadFileName = uploadFile.getName() + ".overwrite." + new Date().getTime(); - fos = new FileOutputStream(getStoreLocation() + UploadConstant.SEPARATOR + uploadFileName); + overwriteFileName = uploadFile.getName() + ".overwrite." + new Date().getTime(); + fos = new FileOutputStream(getStoreLocation() + UploadConstant.SEPARATOR + overwriteFileName); } else { fos = new FileOutputStream(getStoreLocation() + UploadConstant.SEPARATOR + uploadFile.getName()); } @@ -1016,7 +1016,7 @@ fos.close(); is.close(); - UploadParams uploadParams = new UploadParams(uploadFile.getName(), uploadFile.getSize(), uploadFile.getContentType(), UploadConstant.DIR, storeLocation, uploadFileName); + UploadParams uploadParams = new UploadParams(uploadFile.getName(), uploadFile.getSize(), uploadFile.getContentType(), UploadConstant.DIR, storeLocation, overwriteFileName); history.add(uploadParams); notify(uploadParams, uploadFile); } else { --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]