validate problem/logic problem

7 views
Skip to first unread message

Yogista Hanindyajati

unread,
Nov 7, 2009, 6:01:41 AM11/7/09
to koha...@googlegroups.com
Teman2, kira2 apa yg salah ya dg kode ini ?


$validate=Validate::factory($_FILES);
$files= $validate->rules('picture',array('not_empty'=>NULL))); 


if ($files->check())
{
//@unlink('./media/images/news/'.$new_news->picture);
$upload_pic = upload::save($_FILES['picture'],$filename.'.jpg','media/images/news/');
Image::factory($upload_pic)->resize('400','300',Image::AUTO)->save(DOCROOT.'media/images/news/'.$filename.'.jpg');
$new_news->picture=$filename.'.jpg';
$new_news->save();
}


Kenapa kalo saya submit tanpa mengupload suatu gambar, selalu keluar pesan error "

Kohana_Exception [ 0 ]: Not an image or invalid image: /Library/WebServer/Documents/works/timlo


Mohon bantuannya.... Bingung bener nih.. :(

Terima kasih... ^^

Mulia Arifandy Nasution

unread,
Nov 7, 2009, 7:05:28 AM11/7/09
to koha...@googlegroups.com
Kohana berapa ini?? v3 ya?


Facebook: facebook.com/mul14
Twitter: twitter.com/mul14
Yahoo! ID: mul14

Yogista Hanindyajati

unread,
Nov 7, 2009, 7:09:59 AM11/7/09
to koha...@googlegroups.com
Yup, Kohana 3

BTW, udah ketemu barusan.. hehe, masalah ada di 

$files= $validate->rules('picture',array('not_empty'=>NULL))); 

seharusnya

$files= $validate->rule('picture','upload::not_empty'); 

entah kenapa kemarin aku pake deklarasi kedua gak jalan, tadi abis donlot ulang, eeh.. bisa... hehehe...

Terima kasih temen.. maaf , merepotkan.. :P
Reply all
Reply to author
Forward
0 new messages