html - jquery file upload plugin- selected file name not being displayed -
i using jquery file upload plugin(basic) upload single file @ time. plugin works fine , can see files dumped in correct directory, good! when select file, name(chrome)/path(ie) of selected file not displayed, instead displays "no file chosen". how can change display name of selected file? code:
script :
$(function () { $('#fileupload').fileupload({ datatype: 'json', url: '@url.action("index", "home")', add: function (e, data) { data.submit(); }, progress: function (e, data) { var progress = parseint(data.loaded / data.total * 100, 10); $('#progress .bar').css('width', progress + '%'); }, done: function (e, data) { $('<p/>').text(data.files[0].name).appendto(document.body); } //multipart: false }); });
homecontroller :
[httppost] public actionresult index(httppostedfilebase files) { return json(files.filename); }
index :
<input id="fileupload" type="file" name="files"/> <div id="progress" style="width: 250px"> <div class="bar" style="width: 0%;"></div> </div>
pass following arguments fileupload call:
$('#fileupload').fileupload({ formdata:{extra:1}, autoupload: false, url: "uploader.php", replacefileinput:false, fileinput: $("input:file") });
replacefileinput:false
displaying selected file name
Comments
Post a Comment