Commit 410cd60f authored by Jiwon Yoon's avatar Jiwon Yoon
Browse files

디테일이미지 여러개

parent fbce3d1a
...@@ -109,9 +109,9 @@ function ProductsRegist() { ...@@ -109,9 +109,9 @@ function ProductsRegist() {
console.log(product) console.log(product)
const formData = new FormData(); const formData = new FormData();
for (let key in product) { for (let key in product) {
if (key === "main_image" || key === "detail_image") { if (key === "main_image") {
formData.append(key, product[key][0]) formData.append(key, product[key][0])
} else if (key === "sizes" || key === "colors" || key === "sub_category") { } else if (key === "sizes" || key === "colors" || key === "sub_category" || key === "detail_image") {
for (let i = 0; i < product[key].length; i++) { for (let i = 0; i < product[key].length; i++) {
formData.append([key], product[key][i]) formData.append([key], product[key][i])
} }
...@@ -244,7 +244,7 @@ function ProductsRegist() { ...@@ -244,7 +244,7 @@ function ProductsRegist() {
</Form.Group> </Form.Group>
<Form.Group> <Form.Group>
<Form.Label>상세이미지</Form.Label> <Form.Label>상세이미지</Form.Label>
<Form.File id="productImageform" name="detail_image" onChange={handleChange} /> <Form.File id="productImageform" name="detail_image" onChange={handleChange} multiple />
</Form.Group> </Form.Group>
<Button type="submit" style={{ background: '#91877F', borderColor: '#91877F' }} block> <Button type="submit" style={{ background: '#91877F', borderColor: '#91877F' }} block>
{loading && <Spinner as='span' animation='border' size='sm' role='status' aria-hidden='true' />}{' '}등록 {loading && <Spinner as='span' animation='border' size='sm' role='status' aria-hidden='true' />}{' '}등록
......
...@@ -5,7 +5,7 @@ const upload = multer({ dest: 'uploads/' }) ...@@ -5,7 +5,7 @@ const upload = multer({ dest: 'uploads/' })
const imageUpload = upload.fields([ const imageUpload = upload.fields([
{ name: 'main_image' }, { name: 'main_image' },
{ name: 'detail_image' } { name: 'detail_image'}
]) ])
const regist = async (req, res) => { const regist = async (req, res) => {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment