Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
ImageRights  
#1 Posted : Wednesday, May 26, 2010 7:39:12 AM(UTC)
ImageRights

Rank: Newbie

Groups: Member
Joined: 5/26/2010(UTC)
Posts: 3

We have a web site, that use struts. The Image Unloader is integrated in a page uploader.jsp. We define this control to call action 'uploadimage.action'.
This action is called, but when is parse request the file items list size is 0.

Code:
listFileItems = fu.parseRequest(request);
System.out.println(listFileItems.size());         // 0


Why this list have zero size?

The following is the code:

////////////////////////////////////////////////
// uploader.jsp

Code:
<form metod="POST">
<script language="javascript" src="/JSPs/ImageUploader/Scripts/iuembed.js">  </script>
<script language="javascript">

var iu = new ImageUploaderWriter("ImageUploader", 650, 450);
					
// If you do not want to use ActiveX or Java version, set the appropriate
// property to false.
iu.activeXControlEnabled = false;
iu.javaAppletEnabled = true;

iu.javaAppletCodeBase="/JSPs/ImageUploader/";
					
// ... initialize params  ...
iu.addParam("LicenseKey", "xxxxx-xxxxxx-xxxxxxx-xxxxxxxx-xxxxxxxx");
iu.addParam("Action", "/uploadimage.action");
iu.addParam("PaneLayout", "OnePane");
iu.addParam("UploadSourceFile", "true");

iu.addParam("ShowDebugWindow", "true");
iu.addParam("AllowRotate", "false");

iu.showNonemptyResponse = "off";
					
iu.addParam("UploadView", "AdvancedDetails");
iu.addParam("FilesPerOnePackageCount", "1");
iu.addParam("MaxConnectionCount", "1");

iu.writeHtml();
</script>
</form>




Code:
////////////////////////////////////////////////
//  UploadImage.java

public class UploadImage extends BaseAction {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 83964164931876309L;
		
	public String execute(){		
		String galleryPath = "/Gallery/";

		//Process upload.
		ServletContext context = ServletActionContext.getServletContext();
		String absGalleryPath = context.getRealPath(galleryPath);
		String absThumbnailsPath = context.getRealPath(galleryPath + "/Thumbnails");
		String absTempPath = context.getRealPath(galleryPath + "/Temp");

		DiskFileUpload fu = new DiskFileUpload();
		//Set maximum size before a FileUploadException will be thrown.
		fu.setSizeMax(100000000);
		//Set maximum size that will be stored in memory.
		fu.setSizeThreshold(4096);
		//Set the location for saving data that is larger than getSizeThreshold().
		fu.setRepositoryPath(absTempPath);

		//Get uploaded files.
		List listFileItems = null;
		try {
			HttpServletRequest request = ServletActionContext.getRequest();
			listFileItems = fu.parseRequest(request);
			
			System.out.println(listFileItems.size());    // 0
			
		} catch (FileUploadException e) {
			return ERROR;
		}

		//Put them in hash table for fast access.
		Hashtable fileItems = new Hashtable();

		for (int i = 0; i < listFileItems.size(); i++) {
		    FileItem fileItem = (FileItem)(listFileItems.get(i));
		    fileItems.put(fileItem.getFieldName(), fileItem);
		}

		//Get total number of uploaded files (all files are uploaded in a single package).
		int fileCount = Integer.parseInt(((FileItem) fileItems.get("FileCount")).getString());



...........................................

Edited by user Wednesday, May 26, 2010 7:42:55 AM(UTC)  | Reason: Not specified

Tamila  
#2 Posted : Thursday, May 27, 2010 3:24:41 AM(UTC)
Tamila

Rank: Advanced Member

Groups: Member
Joined: 3/9/2008(UTC)
Posts: 554

Was thanked: 1 time(s) in 1 post(s)
Hi,

I just tried to reproduce this problem locally, but everything worked well. It seems that you get incorrect or corrupted POST-request on your server. Let's try to debug this problem. In attachment you can find ExtractFiles.jsp file which allows to dump POST-request. Just put it on your server and point this script in Action property:
Code:
iu.addParam("Action", " ExtractFiles.jsp");


Try to reproduce your problem. After upload completed you will find ExtractDump.txt in the application root folder. Please send me this .txt file.
File Attachment(s):
ExtractFiles.jsp.zip (1kb) downloaded 14 time(s).
Aurigma Support Team

UserPostedImage Follow Aurigma on Twitter!
ImageRights  
#3 Posted : Friday, May 28, 2010 6:59:13 AM(UTC)
ImageRights

Rank: Newbie

Groups: Member
Joined: 5/26/2010(UTC)
Posts: 3

I executed this script on my server, but the result is empty file.
in the following line the len is -1 :

while ((len = inStream.read(buf)) > 0) {
Tamila  
#4 Posted : Sunday, May 30, 2010 8:57:14 PM(UTC)
Tamila

Rank: Advanced Member

Groups: Member
Joined: 3/9/2008(UTC)
Posts: 554

Was thanked: 1 time(s) in 1 post(s)
Hi,

Could you please submit a case about this problem. In support case post the direct link to the page where you experience problem with Image Uploader, also send me login information if necessary.
Aurigma Support Team

UserPostedImage Follow Aurigma on Twitter!
ImageRights  
#5 Posted : Tuesday, June 1, 2010 4:02:48 AM(UTC)
ImageRights

Rank: Newbie

Groups: Member
Joined: 5/26/2010(UTC)
Posts: 3

Hi Tamila
With the action the POST request is really corrupted. I tried the same with servlet and it work.

Regards.
Tamila  
#6 Posted : Wednesday, June 2, 2010 12:57:16 AM(UTC)
Tamila

Rank: Advanced Member

Groups: Member
Joined: 3/9/2008(UTC)
Posts: 554

Was thanked: 1 time(s) in 1 post(s)
Hmm...

Do you still experience the problem? It is not clear.
Aurigma Support Team

UserPostedImage Follow Aurigma on Twitter!
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.