I have the requirement to upload images via gatsby Azure static web app.
Currently I am using the following "tools":
- Azure static web app
- Azure SQL database
My high-level idea is:
- Create input type="file" in Gatsby page/form
- Call REST API to upload the image (and also the other fields of the form like text, numbers, ...) into database
- Store image (and other fields) into Azure sql database column
Is it possible to implement it? If yes, how? Can I upload images with REST-API call via Gatsby form?
Question in general words: What is the best approach to upload files into database with Azure "tools" via Gatsby static web app form?
Please consider that I want to use only Azure "tools" which are free of charge.
The sample code below is for JSON files in Azure SQL, and it integrates file upload functionality into a web application using Node.js, REST API, and Gatsby.
Create a Database Scoped Credential:
Create an External Data Source:
Create a Table for Storing JSON Data:
Upload JSON Data into the Table:
The code below sets up a Node.js Express server with a REST API to handle file uploads to Azure SQL.
I followed this link for building a contact form.
Form in a Gatsby: