is my current code so wrong? i was hoping there is just a litte
mistake hidden...
On 1 Aug., 17:51, "Dave Maharaj" <m...@davemaharaj.com> wrote:
> Check out Miles J Uploader.
>
> http://www.milesj.me/resources/script/uploader-plugin
>
> But that will check the file attempting upon submit. You can use js client
> side first to alert the user only jpg / gif first.
>
> Dave
>
> -----Original Message-----
> From: Tomfox Wiranata [mailto:tomfox.wiran...@gmail.com]
> Sent: August-01-10 1:10 PM
> To: CakePHP
> Subject: file upload: validate if file is image
>
> hi everyone,
>
> in relation,this seems not like a big deal (maybe cause i spent the
> whole weekend figuring out ajax), but somehow i dont get it done. when
> the user is selectig a file for an upload, i wanna make sure it's an
> image.
>
> so far i am checking in my controller
>
> if (($this->data['User']['name']['type'] !=
> 'image/jpeg') ||
> ($this->data['User']['name']['type'] != 'image/png') || ($this-
> >data['User']['name']['type'] != 'image/gif')) {
>
> $this->set('error','Du kannst nur Bilder
> hochladen(jpeg, png,
> gif)');
>
> $this->render('previewprofileimage','ajax');
>
> } else {
> process upload and resize
> }
>
> now what happens is, that even if the file is an image cake won't see
> it. i guess sth with the or operator is messed up???
>
> that's the form btw: the .ctp-file
> <?php
> echo $form->create('User',
> array('name'=>'uploadProfileImageForm','id'=>'uploadProfileImageForm','type'
> =>'file'));
> echo $form->file('User');
> ?>
>
> <button
> onClick="ajaxUpload(this.form,'editprofile','image_preview','<br /
> ><img src=\'../img/icons/loader.gif\' width=\'16\' height=\'16\'
> border=\'0\' />','Error in upload'); return false;"
> type="button">Hochladen</button>
>
> <?php
> echo $form->end();
> ?>
>
> thx a lot :)
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 athttp://groups.google.com/group/cake-php?hl=en
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:
Post a Comment