Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

express formidable

const express = require('express');const formidable = require('formidable'); const app = express(); app.get('/', (req, res) => {  res.send(`    <h2>With <code>"express"</code> npm package</h2>    <form action="/api/upload" enctype="multipart/form-data" method="post">      <div>Text field title: <input type="text" name="title" /></div>      <div>File: <input type="file" name="someExpressFiles" multiple="multiple" /></div>      <input type="submit" value="Upload" />    </form>  `);}); app.post('/api/upload', (req, res, next) => {  const form = formidable({ multiples: true });   form.parse(req, (err, fields, files) => {    if (err) {      next(err);      return;    }    res.json({ fields, files });  });}); app.listen(3000, () => {  console.log('Server listening on http://localhost:3000 ...');});
Comment

PREVIOUS NEXT
Code Example
Javascript :: js background color 
Javascript :: isnan 
Javascript :: nodejs SSE 
Javascript :: dot notation vs bracket notation 
Javascript :: inbox 
Javascript :: how to print json.stringify of nested objects 
Javascript :: javascript add inline style css var 
Javascript :: find if json property is of type date type 
Javascript :: how to remove link in image in jquery 
Javascript :: clear input value with javascript 
Javascript :: strong password javascript 
Javascript :: javascript number and math 
Javascript :: javascript get object value dynamically 
Javascript :: vue multiple slot 
Javascript :: jquery get last element with two class name 
Javascript :: useeffect componentdidmount 
Javascript :: property binding angular 
Javascript :: react input text onchange target method 
Javascript :: angular 14 new features 
Javascript :: fetch thingy 
Javascript :: how to debug node js file in webpack 
Javascript :: take a screenshot javascript of canvas 
Javascript :: adding more than one class react 
Javascript :: calling javascript from java 
Javascript :: node.js vm 
Javascript :: create and save xml file in javascript 
Javascript :: string object javascript 
Javascript :: jquerey dropdown button 
Javascript :: how to detect if javascript is disabled with javascript 
Javascript :: javascript destructuring 
ADD CONTENT
Topic
Content
Source link
Name
3+9 =