kohana 3 uploading image without using any modules?
does anybody have an example of uploading images in kohana 3 without using any modules eventually ?
i used https://github.com/kohana/image/tree/3.1%2Fmaster but my error is: Fatal error: Uncaught Kohana_Exception [ 0 ]: Installed GD does not support images
is there any easy and fast way to upload files in a koha开发者_如何学JAVAna 3 based website?
thanks!
Kohana API should help.
Basic steps are:
- Create Validation object (
$array = Validation::factory($_FILES);
) - Define rules (
$array->rule('file', 'Upload::not_empty')->rule('file', 'Upload::type', array(array('jpg', 'png', 'gif')));
) - Check file(s) (
if ($array->check())
) - And save it (
$filepath = Upload::save($_FILES['file'], 'uploaded_file', 'upload_dir');
)
This will help you :)
http://forum.kohanaframework.org/discussion/6988/ko3-k03-image-library-installed-gd-does-not-support-images/p1
精彩评论