Validation and file upload |
[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
[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.
[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.
[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/passin...imagesize/
[eluser]ontguy[/eluser]
There is a way to validate using CI Validation: http://ellislab.com/forums/viewthread/87756/#442385
[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
[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.
|
Welcome Guest, Not a member yet? Register Sign In |