Sure. I'm probably not going to get to it until Monday or so, but I'll package up my example and send it along.
Larry On 11/20/10 4:54 PM, Frank Stock wrote: > > Hi Larry, > > Thank you for the advice, but it is a bit complicated for me, can you > send met perhaps an example so I can look at it? > > Thanks anyway > Frank > > >> *Van: *Larry Mills-Gahl <l...@webfarm.com <mailto:l...@webfarm.com>> >> *Datum: *20 november 2010 19:55:19 GMT+01:00 >> *Aan: *webobjects-...@lists.apple.com >> <mailto:webobjects-dev@lists.apple.com> >> *Onderwerp: **Antw.: Upload Files* >> >> >> I spent a little time on this but it was a relatively low priority so I >> haven't finished. I could get a defined number of files uploaded without >> any problem, but I wanted to be able to allow the user to add more files >> to the upload batch. The problem was really a display problem because >> when I submitted the (ajax or component) action to add another slot for >> a file upload, the display of previous file names in the form would >> disappear. The information about those files was still in the component >> and ready to be uploaded, but for some reason, (my choice of bindings or >> something) made the form not display the filenames. As I said, this >> wasn't an urgent priority for me, so I let it sit (and it still sits). >> >> As I said, if you have a fixed number of file slots for upload when the >> component is created, this works fine. My problem came in when I added >> to the original file array. Here is what I did (in case anybody else has >> advice on the ability to add more slots for upload) >> >> It seems that AjaxFileUpload and AjaxFlexibleFileUpload focus on single >> file uploads so I worked with a basic WOFileUpload in order to get the >> core bits down. I haven't gotten back to trying to use either of these >> with multiple file uploads, so here is how I've done it up to now... >> >> I have a class called FileUploadMetadata which is just used to contain >> the information required to upload a file. That class contains the info >> to bind to the WOFileUpload. >> >> private String streamToFilePath ; >> private String finalFilePath; >> private String file2upload; >> private String description; >> private int bufferSize = 2000; >> private String overwrite = "true"; >> >> The upload component contains a NSMutableArray<FileUploadMetadata> >> called files2Upload (ok, I know I'm inviting brain damage by calling the >> array files2Upload and the file inside the FileUploadMetadata >> file2Upload, but if I don't put the hard to find typo bugs in who >> will?... anyway...) >> >> The upload method just iterates through the files2Upload and creates a >> new file with the streamToFilePath >> >> The stripped down upload form is: >> >> <wo:WOForm enctype = "multipart/form-data" multipleSubmit = "true"> >> <fieldset> >> <legend>Files:</legend> >> <wo:WORepetition list = "$filesToUpload" item = "$aFileMetadata"> >> <wo:WOFileUpload streamToFilePath = >> "$aFileMetadata.streamToFilePath" finalFilePath = >> "$aFileMetadata.finalFilePath" overwrite = "$aFileMetadata.overwrite" >> bufferSize = "$aFileMetadata.bufferSize" filePath = >> "$aFileMetadata.file2upload" size = "60" /> >> description: <wo:WOTextField >> value="$aFileMetadata.description" /> >> <br /> >> </wo:WORepetition> >> <wo:WOSubmitButton action = "$addFiles" value = >> "addAnotherFile" /> >> </fieldset> >> <wo:WOSubmitButton action = "$upload" /> >> </wo:WOForm> >> >> >> The addFiles action just adds another FileUploadMetadata to the >> files2Upload NSMutableArray. >> The upload action writes out some logging info for me to try to figure >> out why the display isn't what I expect, but the bulk of the work is >> just an iterator... >> >> ListIterator<FileUploadMetadata> it = >> filesToUpload.listIterator(); >> while (it.hasNext()) { >> FileUploadMetadata fum = it.next(); >> uploadInfoBuffer.append("\nfile " : " + fum.getFile2upload()); >> if (fum.getFile2upload() != null && >> fum.getFile2upload().length() > 0) { >> File upfile = new File(fum.getStreamToFilePath()); >> } >> >> } >> >> >> On 11/19/10 10:17 AM, Frank Stock wrote: >> Hi all, >> >> I need to upload several files at a time, what is the best way to do >> it: AjaxUpload or AjaxFlexibleUpload? >> AjaxFlexibleFielUpload uses Adrew Valums routine, but it don't work >> like on the examples of valums website (there you can load several >> file at one time) >> AjaxUpload uses jquery, can I use that so it works with the rest of ajax? >> >> Thank you form giving advice, >> Frank Stock >> >>
_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com