• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Multiple (dynamic) file uploads
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multiple (dynamic) file uploads


  • Subject: Re: Multiple (dynamic) file uploads
  • From: Hugi Thordarson <email@hidden>
  • Date: Mon, 25 Apr 2005 23:45:01 +0000

Hi Julian!

The simplest way for you to do this is to just create a cover method to add the data to an array. If you add something like this to the java class...:

	protected NSMutableArray dataArray = new NSMutableArray();
	protected NSData someData;

	public void setSomeData( NSData data ) {
		if( data != null && data.length() > 0 )
			dataArray.addObject( data );
	}

... and then just bind someData to the "data" binding of your WOFileUpload. Each WOFileUpload's data will be added to "dataArray".

Of course, this assumes that you don't care about the files' names, but that can be handled in a relatively simple fashion using dictionaries. Just let me know if you need that.

Oh, and of course, promise that you'll remember to set your form's encoding to "multipart/form-data" ;-).

Cheers,
Hugi



On 25.4.2005, at 23:06, Julian Wood wrote:

Hi,

I am new to webobjects, but not to java.

I have a situation where I want to have a form with several fields and an indeterminate number of fileuploads. The form starts with one fileupload, but the user can add as many as they want. This is done with a WORepetition. The problem I'm having is in how to receive these uploads.

I have no problem with one upload, or 5 uploads, as long as the number is known. It is just an easy 1:1 binding. But how do I deal with the above indeterminate situation?

I have been playing around with the form values available from the context().request() object, but the streams in there (which are easily locatable) are always empty (which was not entirely unexpected, given the info in the examples). I have been using the component outputstream fileupload example as a basis for this work.

I've also played with the WOMultipartIterator, using a DirectAction. This I can get to work with my indeterminate number of uploads, but how do you get the form values? The values come across fine, but the name identifying each form value is changed to something like "3.1, "3.3", etc. Specifying a name in WOBuilder does not change the name that actually comes in the request. How do I find out which one is my "title", for instance? I see that the java file which contains the bindings for these values is never actually set with the new values (as in WOComponent-based requests), but even if it was, how would I grab it's instance?

Is there a way to do this without using DirectAction? Is there a way to mix a WOComponent-based approach with a DirectAction approach?

Any hints?

Thanks,

J
--
Julian Wood <email@hidden>

Programmer/Analyst
University of Calgary

http://commons.ucalgary.ca

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Multiple (dynamic) file uploads (From: Julian Wood <email@hidden>)

  • Prev by Date: EnhancedFileUploadTools [solved]
  • Next by Date: Re: respondToMessage() error
  • Previous by thread: Re: Multiple (dynamic) file uploads
  • Next by thread: Qualifier with key path keywords
  • Index(es):
    • Date
    • Thread