MCPcopy Create free account
hub / github.com/flatlogic/react-material-admin / uploadToServer

Function uploadToServer

src/pages/user/AddUser.js:88–104  ·  view source on GitHub ↗
(file, path, filename)

Source from the content-addressed store, hash-verified

86 }
87
88 const uploadToServer = async (file, path, filename) => {
89 const formData = new FormData();
90 formData.append('file', file);
91 formData.append('filename', filename);
92 const uri = `${config.baseURLApi}/file/upload/${path}`;
93 await Axios.post(uri, formData,
94 {
95 headers: {
96 'Content-Type': 'multipart/form-data'
97 }
98 }
99 );
100
101 const privateUrl = `${path}/${filename}`;
102
103 return `${config.baseURLApi}/file/download?privateUrl=${privateUrl}`;
104 };
105
106 const handleFile = async (event) => {
107 const file = event.target.files[0];

Callers 1

handleFileFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected