I have a file input field in its own separate form, as such:
<form action="" method="post">
<div class="row">
<label for="image-field">Upload a New Image</label>
** FIELD NEEDS TO APPEAR HERE **
</div>
</form>
<iframe name="upload_iframe" id="upload_iframe" style="display: none;"></iframe>
<form action="#" target="upload_iframe" method="post" enctype="multipart/form-data">
<input id="image-field" onchange="$(this).parent().submit();" type="file" name="image_file" />
</form>
CSS:
#image-field { position: absolute; top: 285px; left: 13px; }
(I am using a hidden IFRAME to upload the file in the background)
Then I have the rest of the form fields in the main form. The problem is I need the file input field to appear (visually) within the main form. Currently I am using position: absolute, with top and left values to position the field. However this is not consistent in appearance across all browsers. I was wondering if there were any better solutions for this?
I can't nest the file upload form within the main form, as this will most likely cause problems.