Php form retaining input about file upload if captcha fails
I would to know how to retain information entered for photo upload in php form if either captcha or invalid entry occurs. All other fields retain their input, with the exception of upload path, i.e. person enters "C:\Users\inc\Desktop\3.png" and path is lost if either occurs during form submission (...php5#error)
开发者_JS百科<div class="photo">
<li class='field_block' id='field_35_div'>
<div class='col_label'>
<label class='form_field'>Photo 1</label>
<label class='form_required' > </label>
</div>
<div class='col_field'>
<input type="file" name="field_35" id="field_35" value="" class='text_box1' onchange="fmgHandler.check_upload(this);">
<div id='field_35_tip' class='instruction'></div>
</div>
I tried adding echo, but this does not work.
File fields cannot be pre-populated. And you probably don't want the user to have to upload the file every time again and again anyway, as that may potentially take a long time.
Save the file somewhere on your server and remember either in the session or in a hidden input field which file it was. Display something like "file uploaded" next to the file selector. If the user choses to upload another file, overwrite the previously uploaded file, otherwise use the previously uploaded file.
精彩评论