对于您无法解决的问题,我需要您的帮助:)
我的程序中有此表格可以上传文件
@using(Html.BeginForm("UploadDocuments", "User", FormMethod.Post, new { enctype = "multipart/form-data", id = "form-upload-documents" }))
{
@Html.AntiForgeryToken()
<ul id="UploadContainer" class="upload-container" data-last-id="0">
<li class="col-upload-figure">
<figure class="upload-figure">
<label class="btn-upload" for="Picture_0">
<span class="btn-upload-text">Add a picture</span>
</label>
<input class="custom-input-file" data-id="0" id="Picture_0" name="Picture_0" type="file">
</figure>
</li>
</ul>
<div class="form-submit">
<button class="btn btn-primary btn-loader" data-style="expand-right" type="submit">Submit</button>
</div>
}
然后检查要使用javascript上传的文件的大小,如果文件太大,我想在不离开当前页面的情况下调用C#类的void方法
$('#Picture_0').change(function() {
var files = $(this).prop('files');
var fullPath = $(this).val();
if (files[0].size > 4*1024*1024) {
$('#Picture_0').val('')*;
// The function of a specific class I would like to call
}
else{
//...
}
})
我该怎么做呢?
精慕HU
肥皂起泡泡
慕容708150
相关分类