новый AjaxUpload, отправляющий дополнительные данные - PullRequest
0 голосов
/ 11 июля 2019

Я использую следующий метод для загрузки файла.Я хочу отправить дополнительный пользовательский ввод.Как я могу это сделать

jquery

<script type="text/javascript" >
$(function(){
    var btnUpload=$('#upload');
    var status=$('#status');
    new AjaxUpload(btnUpload, {
        action: 'upload-file.php',
        name: 'uploadfile',
        onSubmit: function(file, ext){
             if (! (ext && /^(xls|xlsx)$/.test(ext))){ 
                // extension is not allowed 
                status.html('Only xls, xlsx files are allowed');
                return false;
            }
            //status.text('Uploading...');
             jQuery("#plot").html("<img src='images/ajax-loader.gif'/>");
        },
        onComplete: function(file, response){
            //On completion clear the status
            jQuery("#plot").html("");
            status.text('');
            //Add uploaded file to list
            alert(response);

                jQuery("#plot").html(response);
                //.addClass('success')

        }
    });

});

html

 <div>
Kindly ensure that you are uploading .xlsx files (Office 2007) . It should have 8 columns, and data from second row onwards. First row can be used for give headings, if you wish to do so. Column order for data is date (in YYYY-MM-DD) , time (24 hr, hh:mm:ss format),  direction (in degree,) speed (m/s) There is no data validation employed. Hence please ensure that the uploaded file contains valid data.
</div>
Height<input name="height" type="radio" value="10" />10m<input name="height" type="radio" value="60" />60m<input name="height" type="radio" value="100" />100m
<div id="upload" ><span>Upload File<span></div><div id="plot"><span id="status" ></span></div>

        <ul id="files" ></ul>
</div>

Как передать значение выбранного переключателя вместе с файлом

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...