multipart/form-data ajax 提交问题(未解决)

问题再现:

                            <tr valign="top">
                                <td class="ttc pt15" align="center" nowrap="nowrap" width="70"><b>文件路径</b></td>
                                <td id="td1" class="tdof" nowrap="">
                                    <div id="bxAttach" style="position: relative;">
                                        <div id="bxAttach_0" style="margin-bottom: 6px;">
                                            <form id="upform0" name="upform0"
                                                enctype="multipart/form-data" method="post"
                                                action="./upload-down!upload.action" target="_parent">
                                                <input name="upload" id="upload" class="sc"
                                                    style="width: 420px;" size="35" type="file">
                                            </form>
                                        </div>
                                    </div>
                                    <div style="text-align: right; width: 100%;">
                                        <span id="showupadvice"
                                            style="display: none; color: #00007f; float: left">您要上传的资料名称过长,建议控制在30个汉字以内.</span>
                                    </div>
                                </td>
                            </tr>

提交

                <tr>
                                <td>&nbsp;</td>
                                <td align="center" height="60"><input value=" 下一步 "
                                    onclick="javascript:upload();" class="sc" type="button"></td>
                            </tr>

ajax提交代码

    <script type="text/javascript">
        function upload() {
            //$("#upform0").submit();
             var formData = new FormData();
            //formData.append('files[]', $('#upform0').get(0).files[0]);
            //formData.append('file', $('#file-upload').get(0).files[0]);
            $.ajax({
                url: './upload-down!upload.action',
                type: 'POST',
                data: formData,
                cache: false,
                contentType: false,
                processData: false,
            });
         }
    </script>    

 

问题:无法提交。不知道如何取的files的数据

posted @ 2014-04-13 21:35  Alcc  阅读(1092)  评论(0编辑  收藏  举报