You don't try to copy the form to a hidden iframe, you submit the form to the hidden iframe. Set the target
attribute (or property) of the form to the name of the iframe.
var fileForm = $('#attachFile form').prop('target', 'hiddenIframe');
$('#emptyDiv').html('<iframe name="hiddenIframe" id="hiddenIFrame"></iframe>');
or
<form action="my_file.php" method="post" enctype="multipart/form-data" id="uploadFile" target="hiddenIframe">
<input type="file" name="files" id="files">
<input id="fileUploadButton" type="submit" name="upload" value="Upload File" onclick="submitFile()">
</form>