Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

js send file as form input

var input = document.querySelector('input[type="file"]')

var data = new FormData()
data.append('file', input.files[0])
data.append('user', 'hubot')

fetch('/avatars', {
  method: 'POST',
  body: data
})
Comment

PREVIOUS NEXT
Code Example
Javascript :: js function string parameter 
Javascript :: pretty alerts js 
Javascript :: how to enter javascript in html 
Javascript :: textalignvertical not working in ios react native 
Javascript :: javascript splice without changing array 
Javascript :: while vs do while javascript 
Javascript :: reload data in datatable 
Javascript :: print all days names of a month 
Javascript :: array join javascript 
Javascript :: number is prime or not in javascript 
Javascript :: upload image react 
Javascript :: how to change background color on scroll 
Javascript :: javascript returning a function 
Javascript :: conditional style prop react 
Javascript :: image preview before upload jquery 
Javascript :: random number generator javascript with range 
Javascript :: redux extension 
Javascript :: javascript random number up to including 2 
Javascript :: regex to find emails 
Javascript :: regex remove duplicates 
Javascript :: es6 method definition syntax 
Javascript :: complete math objects in javascript 
Javascript :: install vue by CDN 
Javascript :: javascript null or empty 
Javascript :: post method 
Javascript :: how to get current month in express js 
Javascript :: js get selected option elemeng 
Javascript :: minify html using javascript 
Javascript :: javascript date object format yyyy mm dd 
Javascript :: MongoDb user find 
ADD CONTENT
Topic
Content
Source link
Name
8+8 =