新しいページをロードせずにファイルを送信する隠し iframe メソッドを使用しています。これは Internet Explorer を除くすべてのブラウザーで動作します。
フォームと iframe は次のようになります。
<iframe id="hidden_upload" style="display:none" src="" name="hidden_upload" ></iframe>
<form class="" action="upload.php" method="post" target="hidden_upload" enctype="multipart/form-data" id="uploadForm">
<table>
<tbody>
<tr>
<td><label for = "title">Title: </label></td>
<td><input type="text" name="title" id="title" maxlength="40" style="width:300px;"/></td>
</tr>
<tr>
<td><label for="description">Description: </label></td>
<td><textarea id="description" name="description" style="width:460px;height:135px;"></textarea></td>
</tr>
<tr>
<td><label for="file">File: </label></td>
<td><input type="hidden" name="MAX_FILE_SIZE" value="3145728" /><input id="file" type="file" name="file"/></td>
</tr>
</tbody>
</table>
<center><input type="submit" value="Upload" id="filesubmit" onclick="return submitting()"/></center>
</form>
IE で動作する別のページがありますが、doc の種類、フォーム、iframe の構造に違いはありません。
動作中のフォームのアクションを非動作中のアップロードページに設定しようとしたが、IEでも動作したため、アップロードページのヘッダーでもありません。
関数submitting
は機能しており、true を返します。
編集:
簡潔にするために、これも機能しません。
<form class="" action="upload.php" method="post" target="hidden_upload" enctype="multipart/form-data" id="importForm">
<input type="submit" />
</form>
<iframe id="hidden_upload" style="display:none" src="" name="hidden_upload" ></iframe>
編集:これは完全にばかげています。作業ページをそのまま非作業ページにコピーしましたが、それでも機能しませんでした。唯一の違いはディレクトリで、.htaccess ファイルは同一でした。