dev-resources.site
for different kinds of informations.
Process FormData file sent to Node server
Published at
3/19/2023
Categories
file
upload
formdata
attach
Author
brett84c
Author
8 person written this
brett84c
open
I struggled to find much online about how to simply process a FormData file (PDF, in this case) sent to a Node server to be attached to an email or used for other things. This is a very basic example but the key part is this line on the server:
Buffer.from(await file.arrayBuffer())
form.html
<form id="fileForm">
<div>
<label for="pdf_file">File Upload</label>
<input type="file" name="pdf_file" />
</div>
<button type="submit">Send File</button>
</form>
form.js
document.getElementById("fileForm").addEventListener("submit", (e) => {
e.preventDefault();
const formData = new FormData(e);
fetch("/", {
method: "POST",
body: formData
});
});
server.js
app.post('/', async (request, response) => {
const values = await request.formData();
const file = values.get("pdf_file");
const processedFile = Buffer.from(await file.arrayBuffer());
//attach to email or do other things
};
upload Article's
30 articles in total
UploadThing: A Modern File Upload Solution for Next.js Applications
read article
NestJS - Armazenamento nas nuvens
read article
NestJS - criar um endpoint para upload de diversos arquivos
read article
NestJS - Validando o envio de arquivos
read article
NestJS - Armazenamento local de upload
read article
NestJS - criar endpoint para upload de 1 arquivo
read article
Next.js: Upload de imagem para a Cloudflare R2 Utilizando Presigned URL
read article
A file uploader built with shadcn/ui and react-dropzone
read article
Elevate Your GraphQL API: Mastering File Uploads with Yoga GraphQL
read article
Mastering File Uploads in Laravel 11: A Comprehensive Guide
read article
How To Upload Multiple File In Laravel 10
read article
Different approaches to reduce AWS S3 file upload time using AWS-SDK v3 in NodeJS.
read article
How would you handle image upload?
read article
Upload File di Node JS
read article
Uploading Images with Node.js and React.js
read article
Simplifying AWS S3 File Uploads with the Android Library
read article
Laravel 10 Crop Image Before Upload Cropper Js
read article
Enhance Job Seeker Experience: Quick Image Upload for Portals
read article
A file upload sample with NextJs
read article
Azure Storage Account: Unleash the Potential of Cloud-Based Storage
read article
Spheron Network: Browser Upload
read article
Uploading files from terminal on file hosting service, and unlimited cloud storage
read article
Process FormData file sent to Node server
currently reading
Express file upload using Multer
read article
Maximize Your Client Upload Efficiency with the Bulk Upload
read article
Upload images in Ckeditor 5 with Laravel
read article
Eteot Logo
read article
Install & Upload WordPress Plugin
read article
Laravel 9 Multiple Image Upload Example
read article
How To Enhance JavaScript File Upload In Your Web App
read article
Featured ones: