Validation and file upload - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Validation and file upload (/showthread.php?tid=11532) |
Validation and file upload - El Forum - 09-12-2008 [eluser]dimis[/eluser] I have done a validation rule for a form with CI validation. Is there a way to put a file input as require? Dimis Validation and file upload - El Forum - 09-12-2008 [eluser]Bramme[/eluser] Not that I know off, but you can check with $_FILES['userfile']['error'] == 4 if there was a file selected or not. Mind you, you won't be able to repopulate it, as that's against safety regulations. Validation and file upload - El Forum - 09-12-2008 [eluser]dimis[/eluser] Is there a way to resize a image at uploading time? Validation and file upload - El Forum - 09-12-2008 [eluser]Unknown[/eluser] dimis: Yes, it is possible. Here is an example: Code: //STORE USER UPLOADED IMAGE It's just an example, there are other possibilities. I suggest you check the File Upload and Image Manipulation classes. Validation and file upload - El Forum - 09-12-2008 [eluser]phantom-a[/eluser] I think resizing is must for uploaded images. Sometimes they can put php code hack into the image, resizing would effectively null any code cleverly embedded in a image http://ha.ckers.org/blog/20070604/passing-malicious-php-through-getimagesize/ Validation and file upload - El Forum - 09-12-2008 [eluser]ontguy[/eluser] There is a way to validate using CI Validation: http://ellislab.com/forums/viewthread/87756/#442385 Validation and file upload - El Forum - 09-13-2008 [eluser]dimis[/eluser] Thang you. I thing I will extend the validation class but not for this, as megabyte wrote the upload function check if file exists Validation and file upload - El Forum - 09-13-2008 [eluser]ontguy[/eluser] np. Keep this reply in mind while validating the file upload. http://ellislab.com/forums/viewthread/87756/#442182 You could avoid that when you extend the validation class. Validation and file upload - El Forum - 09-13-2008 [eluser]dimis[/eluser] Thank you. I will use it! |