Skip to content

Instantly share code, notes, and snippets.

View AhsanSN's full-sized avatar
💭
Making Spaghetti since 2013 👨‍💻

Ahsan Ahmed AhsanSN

💭
Making Spaghetti since 2013 👨‍💻
View GitHub Profile
@magemore
magemore / example.js
Created August 10, 2016 10:13
upload image from clipboard on ctrl+v event on page
function uploadFile(file) {
var formData = new FormData();
formData.append("userfile", file);
var request = new XMLHttpRequest();
request.onload = function () {
if (request.status == 200) {
document.location.href='/';
} else {
alert('Error! Upload failed');
}