有没有办法从后端发送前端的FormData来管理它的值?
我的意思是这样的:
onFormSubmit = async (event) => {
event.preventDefault();
const { imageFile, currentGroupId } = this.state;
var formData = new FormData();
formData.append('groupImage', imageFile);
formData.set('groupId', currentGroupId);
const config = {
headers: {
'content-type': 'multipart/form-data'
}
};
await axios.post('/fileUpload/group', formData, config);
}
并获得如下值:
uploadFile(req, res) {
const { uploadsPath } = this.porperties;
const { formData } = req.body;
console.log(formData.get('groupId'));
}
或者我可以选择哪些替代方法?
答案 0 :(得分:0)
我发现您正在尝试使用 multer 之类的模块将文件从前端上传到服务器。
for i in `curl -s https://USR:PWD@api.github.com/orgs/ORG/repos?per_page=200 |
jq .[].ssh_url | sed 's/"//g' | sed 's/git@//g' |
sed 's/github.com:ORG\///g' | sed 's/.git//g' `
do
echo -e "Starting to Clone : $i" && git clone https://USR:PWD@github.com/ORG/$i
done