file upload js code example

Example 1: javascript upload file button

<input id='fileid' type='file' hidden/>
<input id='buttonid' type='button' value='Upload MB' />

Example 2: javascript upload file button

document.getElementById('buttonid').addEventListener('click', openDialog);

function openDialog() {
  document.getElementById('fileid').click();
}

Example 3: nexusjs file upload

import { GraphQLUpload } from 'graphql-upload'export const Upload = asNexusMethod(GraphQLUpload, 'upload')

Example 4: nexusjs file upload

t.field('updateProfilePic', {  type: User,  args: {    pic: arg({ type: Upload, required: true }),  },  resolve: async (root, args, context) => {    const { createReadStream, mimetype, filename } = await args.pic.file    // ...   // ...  },})

Tags:

Css Example