在我使用MV.NET执行的文件上传操作选项中,我在上传文件时得到gethttp://localhost:55298/home/test2.json 404(Not Found)
错误。 我该怎么解决这个问题。
<input type="file" name="file" id="file" accept="application/JSON" />
var dosyaAdi;
$('input[type="file"]').change(function(e){
dosyaAdi = e.target.files[0].name;
$("#file").click(function () {
if ("#file".length > 1) {
$('#file').prop('disabled', true);
}
});
$.getJSON(dosyaAdi, function (data) {
$("#btn").click(function () {
const trackplayback = L.trackplayback(data, map, {
targetOptions: {
}
});
const trackplaybackControl = L.trackplaybackcontrol(trackplayback);
trackplaybackControl.addTo(map);
})
})
});
http://localhost:55298/home/test2.json
-查看Url-您的GET方法正在点击/home/test2.json
Url。 因此,系统正在查找名为test2.json
的物理文件。 不是在寻找行动。
你要打的动作的名称是什么? 如果它是一个GET方法,那么您可以简单地从web浏览器测试操作。
你还提到你正在尝试上传一个文件。 除非是Ajax请求,否则您应该执行HTTP POST
来上传文件,而不是执行GET
。