initial
This commit is contained in:
commit
74ae93a96e
1 changed files with 94691 additions and 0 deletions
|
|
@ -0,0 +1,46 @@
|
|||
Reverse Engineering
|
||||
|
||||
- sdrive(Works only in nodejs due to CORS)
|
||||
|
||||
```jsx
|
||||
const fetch=require('node-fetch')
|
||||
const fs=require('fs')
|
||||
const FormData = require('form-data');
|
||||
const axios=require('axios')
|
||||
|
||||
const file=fs.readFileSync('image_icon.png')
|
||||
|
||||
const url='https://sdrive.app/publicapi/upload'
|
||||
|
||||
// const formData=new FormData()
|
||||
|
||||
// formData.append('file',file)
|
||||
|
||||
|
||||
// fetch(url,{
|
||||
// method: 'post',
|
||||
// body: file
|
||||
|
||||
// })
|
||||
// .then(res=>res.text())
|
||||
// .then(html=>{
|
||||
// fs.writeFileSync('content.html',html)
|
||||
// })
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append('file', file, { filename: 'image_icon.png' }); // Specify the filename when appending the file
|
||||
|
||||
axios.post(url, formData, {
|
||||
headers: {
|
||||
...formData.getHeaders() // Include headers from FormData
|
||||
}
|
||||
})
|
||||
.then(response => {
|
||||
console.log('File uploaded successfully:', response.data);
|
||||
// Handle the response data as needed
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error);
|
||||
// Handle any errors that occurred during the upload
|
||||
});
|
||||
```
|
||||
Loading…
Reference in a new issue