Appframe Knowledge Base


1 hits
1

Change file in a filetable with web4


HTML:
<div class="modal fade" id="fileupload">
	<div class="modal-dialog">
        <div class="modal-content" style="min-height:300px;">
			<div class="modal-header">
                <h4 class="modal-title">Change file</h4>
            </div>
            <div class="modal-body">
                    <input id="fileInput" name="fileInput" type="file" /><br />
                    <button type="button" class="btn btn-default btn-lg fileChange" data-inputfileid="fileInput">Upload File</button> <!-- inputfileid it used to know where the file input is. -->
            </div>    
        </div>    
	</div>
</div>	    


JS:


//**** Edit file without edit and upload plugin (update File)
function ChangeFile(pFileInputID) {
    var pFileInput = $('#' + pFileInputID);
    console.log(pFileInput[0]);
    var vFileUploader = new af.components.Uploader({
		url: "/file/upload/" + af.article.id + "/dsFiles/" + dsFiles.currentRow("PrimKey")
	});
	
    var hideIndicator = af.controls.working("Uploading file...");
	
	vFileUploader.upload(pFileInput[0], function() {
	     	dsFiles.refreshCurrentRow();
	        hideIndicator();
	        $('#fileupload').modal('hide');
	});
}

$('.fileChange').click(function() {
    ChangeFile($(this).data('inputfileid'));
});

web · Perma link post comment Posted by: Erik Skagen Vindenes (16-apr-2015)