Php 剑道UI文件上传器表单为空
我正在将现有的应用程序转换为使用剑道文件上传程序,但上传程序不提交文件。以下是相关的HTML:Php 剑道UI文件上传器表单为空,php,file,file-upload,kendo-ui,Php,File,File Upload,Kendo Ui,我正在将现有的应用程序转换为使用剑道文件上传程序,但上传程序不提交文件。以下是相关的HTML: <div class="form-sort large bottom-radius"> <!-- Attachment form --> <input type="file" multiple="multiple" name="attachments[]" id="addProjectAttach
<div class="form-sort large bottom-radius">
<!-- Attachment form -->
<input type="file" multiple="multiple" name="attachments[]" id="addProjectAttachments" class="project-input" style="position: absolute; left: -9999px; top: -9999px; z-index: -9999;" data-key="files" />
<small class="error">Please provide a project attachment</small>
<!-- /Attachment form -->
</div>
页面向适当的端点发出请求和ajax请求/upload/add
,但提交的表单没有该文件。以下是上传者提交给服务器的内容的屏幕截图:
如何让文件上传程序实际发送文件
更新:为了强调另一端没有收到任何内容,以下内容都是空的
$\u文件
,$\u帖子
,$\u请求
,文件获取内容('php://input)
。此外,当图像大小约为2MB时,请求大小本身仅为672B 此类有效载荷有时可能无法在Chorme的开发者工具中正确显示-当我使用例如在上进行测试时,当我上载文本为“aaaaaaaaaaaaaaaaaa”的文本文件时,我可以看到以下有效载荷:
------WebKitFormBoundaryxjprkqww7bTpl1IF内容处置:表单数据;name=“文件”;filename=“testUpload.txt”内容类型:
文本/纯文本
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
------WebKitFormBoundaryxjprkqww7bTpl1IF--
该示例是PHP剑道库,而不是Javascript库。另外还有
$\u文件
、$\u发布
和文件的内容('php://input“)
都是空的。此外,当图像大小约为2MB时,请求大小本身仅为672B。我刚刚测试了链接演示下面提供的PHP代码,它在我这边正常工作-这里是一个。请使用剑道UI而不是剑道PHP。提供的示例使用了错误的库。KendoUI实际上也是在PHP包装器的保护下使用的。然而,我已经用jQuery库对它进行了测试,它在官方数据库上的工作方式与此相同——下面是测试结果。我做了与您相同的事情。创建了一个包含AAAA的文件并将其上载。您可以通过有效负载描述看到其未正确包含:---WebKitFormBoundarydnbBBwX9lCwrK3cA内容配置:表单数据;name=“”;filename=“a.txt”内容类型:text/plain-----webkitformboundarydnbbwx9lcwrk3ca--
/**
* Initialize Kendo Upload
* @external 'kendoUpload()'
* @see {@link https://demos.telerik.com/kendo-ui/upload/index}
*/
$inputAttachments.kendoUpload({
async: {
saveUrl: '/upload/add',
removeUrl: '/upload/remove',
autoUpload: true
},
success: onSuccess,
remove: onRemove
});