Monday, July 5, 2010

Re: Nick Baker's FileUpload

Hey Nick,

Thank you. It is great right out of the box.

I am using actsAs for all of them actually.

Here are the three that are goofing with me.

Upon further exploration as noted above I removed the cshow model and
it started going into the artist_preference model??

Then I removed that one and it didn't upload at all. I put the cshow
back up and voila, right back into the folder specified for that
model. So weird huh?

Thanks again.

Here is the model code.

cshow:

class Cshow extends AppModel {
var $name = 'Cshow';
var $actsAs = array(
'FileUpload.FileUpload' => array(
'uploadDir' => 'files/img_thegarage',
'fields' => array('name' => 'image', 'type' => 'image_type',
'size' => 'image_size'),
//'allowedTypes' => array('pdf' => array('application/
pdf')),
'required' => false, //default is false, if true a
validation error would occur if a file wsan't uploaded.
'maxFileSize' => '2097152', //bytes OR false to turn off
maxFileSize (default false)
'unique' => true //filenames will overwrite existing files
of the same name. (default true)
//'fileNameFunction' => 'sha1' //execute the Sha1 function
on a filename before saving it (default false)
)
);

I have some validation and it hasMany cshow_comment.

artist_preference

class ArtistPreference extends AppModel {
var $name = 'ArtistPreference';
var $actsAs = array(
'FileUpload.FileUpload' => array(
'uploadDir' => 'files/img_artisticon',
'fields' => array('name' => 'image', 'type' => 'image_type',
'size' => 'image_size'),
//'allowedTypes' => array('pdf' => array('application/
pdf')),
'required' => false, //default is false, if true a
validation error would occur if a file wasn't uploaded.
'maxFileSize' => '2097152', //bytes OR false to turn off
maxFileSize (default false)
'unique' => true //filenames will overwrite existing files
of the same name. (default true)
//'fileNameFunction' => 'sha1' //execute the Sha1 function
on a filename before saving it (default false)
)
);

validation again and it belongsTo user and band

AND THE CULPRIT:

egaragead

class Egaragead extends AppModel {
var $name = 'Egaragead';
var $actsAs = array(
'FileUpload.FileUpload' => array(
'uploadDir' => 'files/img_egarageads',
'fields' => array('name' => 'image', 'type' => 'image_type',
'size' => 'image_size'),
//'allowedTypes' => array('pdf' => array('application/
pdf')),
'required' => false, //default is false, if true a
validation error would occur if a file wsan't uploaded.
'maxFileSize' => '2097152', //bytes OR false to turn off
maxFileSize (default false)
'unique' => true //filenames will overwrite existing files
of the same name. (default true)
//'fileNameFunction' => 'sha1' //execute the Sha1 function
on a filename before saving it (default false)
)
);

took out validation for now - no relations.

On Jul 5, 6:10 pm, nurvzy <nur...@gmail.com> wrote:
> Hi Bradmax,
>
>   First, thanks for using the plugin.  Sorry to hear of your
> troubles.  Is your ad model the only model that is using actsAs
> configuration, (ie the rest using the component?).   Would you mind
> showing me how you have it (and the working models) configured?
>
> Thanks,
> Nick
>
> On Jul 5, 6:07 pm, bradmaxs <b...@pezzano.com> wrote:
>
>
>
> > UPDATE: I removed the show model and it is going to another one in
> > it's place.  What have I done...
>
> > On Jul 5, 4:54 pm, bradmaxs <b...@pezzano.com> wrote:
>
> > > Hi All,
>
> > > I have been using Nick Baker's FileUpload with much success.
>
> > > Except for one incredibly strange problem.
>
> > > I am using the plugin for about 8 models and each has a different
> > > upload folder/destination.
>
> > > All of them are working fine except for the ad model.
>
> > > Initially I was having trouble getting the ads add form to upload the
> > > image to the specified folder.  The record was being saved but the
> > > image was not getting uploaded.  The show model was working great so I
> > > copied the actsAs code and pasted in my ad model. I also changed the
> > > path to the upload folder for the ad model. All of a sudden the images
> > > were being uploaded to the shows destination folder even though that
> > > is not the folder specified in my ad model???
>
> > > For the life of me I can't figure this out.
>
> > > The ad model is using the show model's upload directory path??
>
> > > I have tried everything. I have cleared the cache a million times.
>
> > > I removed the show model and cleared the cache and it STILL did it.
>
> > > Has anyone heard of this?  Is it actsAs that is goofing me?  Am I
> > > missing something?  I just can't see how I can remove the show model
> > > with the destination path it is using (god knows why), clear all the
> > > cache folders (models, persistent and views) and it still happens.
>
> > > I am in crazy bizzaro world.
>
> > > Please help.

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: