Welcome Guest, Not a member yet? Register   Sign In
Help pls.Forms validation with file upload
#1

[eluser]svlada5[/eluser]
Here is my problem , i wanna submit form with text, and pics, but in form_open() i cant handle two methods for form_validation and file_upload in same time. How also i can implement form_open_multypart() and helper to upload files, when i already got login/create function to handle my form validation


<?php echo form_open("login/create" );?>
<div class="form-group">
<label for="exampleInputPassword1">Ime:</label>
&lt;input type="name" class="form-control " id="name" placeholder="Vaše ime" name="name" value="&lt;?php set_value('name'); ?&gt;"&gt;
</div>

<div class="form-group">
<label for="exampleInputEmail1">Prezime:</label>
&lt;input type="name" class="form-control" id="exampleInputEmail1" placeholder="Vaše prezime" name="lastname"value="&lt;?php set_value('lastname'); ?&gt;"&gt;
</div>

<div class="form-group">
<label for="exampleInputEmail1">Korisničko ime:</label>
&lt;input type="name" class="form-control" id="exampleInputEmail1" placeholder="korisnsičko ime" name="username"value="&lt;?php set_value('username'); ?&gt;"&gt;
</div>

<div class="form-group">
<label for="exampleInputPassword1">Šifra:</label>
&lt;input type="password" class="form-control" id="exampleInputPassword1" name="password" placeholder="Šifra"&gt;
</div>

<div class="form-group">
<label for="exampleInputPassword1">Potvrdite šifru:</label>
&lt;input type="password" class="form-control" id="exampleInputPassword1" name="password1" placeholder="Potvrdite šifru"&gt;
</div>

<div class="form-group">
<label for="exampleInputPassword1">Odaberite sliku</label>
&lt;input type="file" class="form-control" id="slika" name="password1" placeholder="Potvrdite šifru"&gt;
</div>

<button type="submit" class="btn btn-primary">Kreiraj nalog</button>

&lt;?php echo form_close();?&gt;
#2

[eluser]treenef[/eluser]
What I do in my controller is check if file is uploaded first then do a form validation on the data fields so...

Code:
if form upload == true
{
    form input filed check() == true()
   {
    return success
   }
   else
  {
     return fail
   }
}
else
{
return fail
}




Theme © iAndrew 2016 - Forum software by © MyBB