diff --git a/src/pages/form-page.jsx b/src/pages/form-page.jsx index 88200ab..04fa155 100644 --- a/src/pages/form-page.jsx +++ b/src/pages/form-page.jsx @@ -16,9 +16,19 @@ function FormPage (){ }; const changeHandler = async(event) => { - // if (event.target.files[0]) - // { - + if (event.target.files[0]) + { + const data = new FormData(); + data.append("file", event.target.files[0], event.target.files[0].name); + data.append("isSync", true); + const res = await starton.post('/ipfs/file', + data, { + headers: { + "x-api-key": 'sk_live_89c7396e-c994-415e-9127-8bb3f7b8a7d4', + "Content-Type": "multipart/form-data"}, + }) + console.log(res.data); + } // let reader = new FileReader(); // reader.readAsDataURL(event.target.files[0]); // reader.onload = () => { @@ -31,30 +41,18 @@ function FormPage (){ // console.log(response.data); // }) // } - // } - // console.log(typeof event.target.files[0]) // // console.log(event.target.files[0]); // const file1 = new Buffer.from(JSON.stringify(event.target.files[0])); // console.log(file1); // // const file1 = await toBase64(event.target.files[0]); - const data = new FormData(); - data.append("file", event.target.files[0], event.target.files[0].name); - data.append("isSync", true); - const res = await starton.post('/ipfs/file', - data, { - headers: { - "x-api-key": 'sk_live_89c7396e-c994-415e-9127-8bb3f7b8a7d4', - "Content-Type": "multipart/form-data"}, - }) - console.log(res.data); }; return ( <>
The creator of this contract
@@ -102,7 +100,7 @@ function FormPage (){About the contract
@@ -118,7 +116,7 @@ function FormPage (){The receiver
@@ -133,12 +131,12 @@ function FormPage (){(Quotation, Specifications ...)
+Are you tired of complex and slow administration ?
Get your first decentralized contract, entirely
managed with blockchain technology