Skip to content

Instantly share code, notes, and snippets.

@akash4gb
akash4gb / imgUpload.html
Created October 5, 2019 09:13
[Instant preview image] To preview image instantly in img tag after selecting img as input file. #jQuery #image #input
<label style="cursor: pointer;">
<img id="imgPreview" src="#" height="140" width="140" />
<input type="file" id="UploadImg" style="display:none" onchange="readURL(this);" />
</label>
@akash4gb
akash4gb / OnlyCharInput.js
Created October 5, 2019 06:16
[Input takes only characters] This piece of code enbles only character input #input #jQuery #OnlyCharacterInput
function testInput(event) {
var value = String.fromCharCode(event.which);
var pattern = new RegExp(/[a-zåäö ]/i);
return pattern.test(value);
}
$('#FullName').bind('keypress', testInput);
@akash4gb
akash4gb / FileModel.cs
Last active September 30, 2019 05:07
[Upload File in .NET MVC] To Upload files using Ajax Form Submit and Model. #Upload #.NET #FileUpload
public class File
{
public long FileId { get; set; }
public long DocumentOwenerId { get; set; }
public long DocumentType { get; set; }
public string Description { get; set; }
public string UploadDocument { get; set; }
}