Part of the EllisLab Network
   
7 of 7
7
Extended form_validation: now with file checking :)
Posted: 23 January 2010 01:33 PM   [ Ignore ]   [ # 61 ]  
Summer Student
Total Posts:  14
Joined  03-03-2008
GodsHand - 14 October 2009 04:28 PM

Any reason why an error message isn’t being displayed when no file is selected?

CONTROLLER

$this->form_validation->set_rules('userfile','Image','file_required');

VIEW

<p class="input_text">
<
label for="userfile">Select Photo</label>
<
input type="file" name="userfile" id="userfile" />
<?php if (form_error('userfile')): echo '<span class="error">'.form_error('userfile').'</span>'; endif; ?>
</p>

I have the same problem as this. It’s weird that when you use

<?php echo validation_errors(); ?>

the error is there.

I used this dirty hack for the time being:

<?php if(strpos(validation_errors(), "No file selected") !== false) { echo '<p>No file selected</p>'; } ?>

And placed it just underneath

<?php echo form_error('userfile') ?>

. This way all the other errors work fine.

Profile
 
 
Posted: 08 February 2010 11:30 PM   [ Ignore ]   [ # 62 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  490
Joined  09-11-2008

nice extension i really like it but one thing i want to ask can we use it for multiple file upload or array of files uploading. for example

<input type="file" name="upload[]" />
<
input type="file" name="upload[]" />
<
input type="file" name="upload[]" />

will it work for it.

 Signature 

CI,JQuery,Google Maps

Profile
 
 
Posted: 23 February 2010 02:32 PM   [ Ignore ]   [ # 63 ]  
Summer Student
Total Posts:  2
Joined  12-03-2009

does anyone know why file_max_size[xxx] isnt working? im using this:

$this->form_validation->set_rules('blog_banner', 'Blog Banner', 'file_required|file_allowed_type[image]|file_max_size[100KB]');

everything but file size max works can anybody help me?

thanks guys

/* update */

found my problem lol using it wrong way around was using file_max_size when its file_size_max lol :D spent hours banging me head with this too lol

Profile
 
 
   
7 of 7
7
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 819, on March 11, 2010 11:15 AM
Total Registered Members: 120603 Total Logged-in Users: 42
Total Topics: 126642 Total Anonymous Users: 2
Total Replies: 665701 Total Guests: 495
Total Posts: 792343    
Members ( View Memberlist )
Newest Members:  bell143paololukDarleneChadbourneRashadSargIvar89HonschowmtRetliffherzigerjudith