Welcome Guest, Not a member yet? Register   Sign In
The set_value() can't use with teyp="file"?(Solved)
#1

[eluser]fell0206[/eluser]
Hello, I'm encountered a problem. When I followed the "user guide" of "file uploading class", I want value can be re-populating, so I add "set_value...", but it can't work, how can I fix it? Thank you!
My Code:
<input type="file" name="Image1" id="Image1" class="text-input medium-input" value="<?php echo set_value('Image1'); ?>" >
#2

[eluser]InsiteFX[/eluser]
Code:
// CodeIgniter User Guide!
<input type="text" name="quantity" value="<?php echo set_value('quantity', '0');?>" size="50" />

// Your Code.
<input type="file" name="Image1" id="Image1" class="text-input medium-input" value="<?php echo set_value('Image1', 'Image1);?>">

InsiteFX
#3

[eluser]danmontgomery[/eluser]
You can't re-populate file inputs. This isn't a codeigniter limitation, but an HTML limitation (if we're calling it a limitation, which I don't really think it is). Regardless, set_value() checks POST data, and uploaded files are in $_FILES, not $_POST.

If you want to repopulate a file upload field, you would need to store the file regardless of form validation and note that a file has been uploaded another way.
#4

[eluser]fell0206[/eluser]
OK! I known, thank you for your help.




Theme © iAndrew 2016 - Forum software by © MyBB