Re: Having trouble with WOFileUpload
Re: Having trouble with WOFileUpload
- Subject: Re: Having trouble with WOFileUpload
- From: David Chaney <email@hidden>
- Date: Sat, 22 Jul 2006 09:22:56 -0400
Janine,
I have done something similar to this by using two separate
applications. One application to to administer the data (i.e add,
modify, delete) that data and then the main website to display the
content.
In the administration application I specifically use a fairly basic
Direct To Web wo app with a CustomComponent for the NSData mapping.
However, my CustomComponent is primarily based on the FileUpload
example locate in the /Developer/Examples/JavaWebObjects folder on
the mac install. I, like yourself needed two sizes, but instead
uploading two files, I upload the largest one and create the smaller
one with resizing code in the application. In addition to java code,
this can also be done with external utilities like ImageMagick, sips,
or QuickTime for java. I think you will find this method much more
convenient and scalable (expand to 3 or 4, etc sizes) long term.
There are many examples of this on the forum and from some of the
outside common wo help sites...
My main website consists primarily of direct actions since I do not
need to manage sessions. Again, as newby I used the the ThinkMovies
example also located in the /Developer/Examples/JavaWebObjects folder
on the mac install to help me get started here.
Finally, there are lots of opinions of whether to store the images in
the database or on the filesystem. I decided on the former for ease
of management and use mysql as the db. If you do store the images in
the database be sure to store them and their immediate attributes
(i.e filename, nsdata-small, nsdata-large, mimetype) in their own
table. Long term, I would like to have the images on the filesystem
and in the db by exporting the images from mysql daily using a script
and have the main application refer to those instead, but overall I
have been pleased with the performace.
Hope this helps,
- David
On Jul 22, 2006, at 2:38 AM, email@hidden wrote:
I'm building my first WO app (not counting the tutorial) and I'm
stuck. First time of many, I'm sure. :)
My goal is to duplicate this site: http://www.nhlpm.org. We put
that together as a temporary site for a former neighbor, who has a
license plate museum in his garage. Right now it's static HTML,
and the long-term goal is to build him a really snazzy site to
showcase his collection. But for now I just want to duplicate
what's there, which means (disregarding the intro page) I need one
display page and one set of add/edit/delete pages.
My entity is called Panel, and I made it through all the EOModeler/
FrontBase stuff without too much trouble. I decided to write the
"add" page first, since I need to get something into the database
before I can do anything else. So first I wrote an add page that
just handled the title and description, and life is good. Data is
making it's way into the database just fine.
Now I need to handle the thumbnail and full-sized images. I knew
this would be the hard part; I've seen a number of people having
trouble with WOFileUpload. So I started out simple - no file type
checking or anything, just get the data into the database.
The two attributes are called thumbnail and bigImage, and they are
both BLOBs on the database side and NSData on the application side.
My first attempt was to put the two WOFileUploads into my form, and
bind their data attributes directly to the corresponding entity
attributes. No errors, but no data being saved either. I tried
this first without the enctype set, then with it set to "multipart/
form-data". I also tried binding them to independent NSDatas as
well, and then using those to set the ones in the entity, but no
luck. My next step is to check the length of those NSDatas and see
if the files are being uploaded at all, but it's late and that will
have to wait.
Is there anything obvious I'm doing wrong here? I thought I read a
discussion of this not too long ago on one of the lists, but Google
isn't finding it for me.
thanks,
janine
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40mac.com
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