c# - how can I add a prefix string in the filename when upload a file using qq.FileUploader -
my code this, how can add prefix "123_" front of filename when user uploads 1.jpg, , change 123_1.jpg server?
<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 files here 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>
pretty simple,
public actionresult savefile(httppostedfilebase fileupload) { string filename = ""; if (fileupload != null && fileupload.contentlength > 0) { filename = "123_"+ path.getfilename(fileupload.filename); //rest code
Comments
Post a Comment