file uploaded check |
[eluser]pendalpusher[/eluser]
I am trying to put a file input on a field, that the user can use to upload a new replacement image if they want. How do i access the field to see if it is empty or full before trying to upload the file? i am using Code: <?=form_upload('userfile');?> i just want to see if the field is empty when it is posted. Thanks, P
[eluser]Bart v B[/eluser]
Then you need to setup some validation rules Take a look in the userguide: Form validation class in youre controller: Code: <?php
[eluser]alphane[/eluser]
Setting it as a required field using form_validation will mean the user has to replace an image every single time. You can determine whether a file has been uploaded using either the file objects error code or file size as so: Code: if ( $_FILE['yourfile']['size'] > 0 )
[eluser]pendalpusher[/eluser]
when i use this code Code: if ( $_FILE['userfile']['size'] > 0 ) i get the following error Code: A PHP Error was encountered Any other suggestions would be great. C
[eluser]pendalpusher[/eluser]
Arrghh .. that's what i get for quick posting... I should have seen this before. $_FILES ... not .... $_FILE. All is working now. thanks, |
Welcome Guest, Not a member yet? Register Sign In |