我的代码是这样的,如何添加前缀,如" 123 _"当用户上传如1.jpg时,在文件名的前面,然后将其更改为123_1.jpg到服务器?
<script type="text/javascript">
var uploader = new qq.FileUploader({
element: document.getElementById('file-uploader'),
allowedExtensions: ["jpg", "pdf"],
template: '<div class="qq-uploader">' +
'<div class="qq-upload-drop-area"><span>drag the files to here to upload</span></div>' +
'<div class="qq-upload-button">upload files</div>' +
'<ul class="qq-upload-list"></ul>' +
'</div>',
action: '@Url.Action("upload", new { staffId = Model.StaffId })'
});
</script>
答案 0 :(得分:0)
非常简单,
public ActionResult SaveFile(HttpPostedFileBase FileUpload)
{
string fileName = "";
if (FileUpload != null && FileUpload.ContentLength > 0)
{
fileName = "123_"+ Path.GetFileName(FileUpload.FileName);
//rest code