File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -2,19 +2,21 @@ import { api } from './api';
22
33export default async function uploadImage ( file ) {
44 const formData = new FormData ( ) ;
5- formData . append ( 'image' , file ) ;
5+ formData . append ( 'file' , file ) ;
6+ formData . append ( 'upload_preset' , 'profile_upload' ) ;
7+ const cloudName = import . meta. env . VITE_CLOUD_NAME ;
68
79 try {
810 const res = await api . post (
9- `https://api.imgbb .com/1/upload?key= ${ import . meta . env . VITE_API_KEY } ` ,
11+ `https://api.cloudinary .com/v1_1/ ${ cloudName } /image/upload ` ,
1012 formData ,
1113 {
1214 headers : {
1315 'Content-Type' : 'multipart/form-data' ,
1416 } ,
1517 } ,
1618 ) ;
17- return res . data . data . url ;
19+ return res . data . secure_url ;
1820 } catch ( error ) {
1921 console . error ( '이미지 업로드 실패' , error ) ;
2022 throw error ;
You can’t perform that action at this time.
0 commit comments