私はこの参照 http://www.openjs.com/articles/ajax/ajax_file_upload/response_data.php を ajax アップローダーに使用しています。単一のアップロードでは問題なく動作しますが、このスクリプトを複数のアップロードに変換したいガイダンスも役立ちます。
単一のフォームを使用して複数の iframe をターゲットにする方法を知りたいだけです。現在のスクリプトは、このような spacefic formId のターゲットであり、このフォームには入力ファイルが 1 つしか含まれていません...
コード
<script type="text/javascript">
function init() {
document.getElementById("file_upload_form").onsubmit=function() {
document.getElementById("file_upload_form").target = "upload_target";
document.getElementById("upload_target").onload = uploadDone;
}
}
window.onload=init;
<script>
<form id="file_upload_form" method="post" enctype="multipart/form-data" action="http://www.appifylabs.com/web/php-upload-progress-bar/uploaderSecond/upload.php/">
<input name="file" id="file" size="27" type="file" multiple="multiple"/><br />
<input type="submit" name="action" value="Upload Image" /><br />
<iframe id="upload_target" onload="uploadDone()" name="upload_target" src="" style="width:600px;height:600px;border:1px solid #ccc;"></iframe>
</form>
試み はうまくいきませんでした
<script type="text/javascript">
function init() {
document.getElementById("file_upload_form").onsubmit=function() {
document.getElementById("file_1").target = "upload_target_1";
document.getElementById("file_2").target = "upload_target_2";
}
}
window.onload=init;
<script>
知らせ
私はuploadify、JqueryUploader、Valumなどのサードパーティのアップローダを使用したくありません。学ぶ理由だけです