# 파일 업로드 시 사용자 정의 필드 데이터가 저장/업데이트되지 않음

**URL:** https://meta.discourse.org/t/custom-field-data-not-saving-updating-for-file-upload/320152
**Category:** Development
**Created:** [8월 5, 2024, 12:03오후 UTC](https://meta.discourse.org/t/custom-field-data-not-saving-updating-for-file-upload/320152 "2024-08-05T12:03:44Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Harshit\_Dave](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/harshit_dave/32/379059_2.png) [@Harshit\_Dave](https://meta.discourse.org/u/Harshit_Dave)
#### Post date: [8월 5, 2024, 12:03오후 UTC](https://meta.discourse.org/t/custom-field-data-not-saving-updating-for-file-upload/320152/1 "2024-08-05T12:03:44Z")

</div>

안녕하세요,

토픽에 파일을 업로드할 수 있는 커스텀 필드를 추가했습니다. 토픽 생성 시 또는 저장/편집 버튼을 클릭할 때 파일을 업로드하려고 합니다. `/uploads.json` API를 사용하여 파일은 정상적으로 업로드되지만, 어째서인지 데이터베이스에 데이터를 업데이트하지 못하겠습니다.

아래 코드를 사용했습니다:

> api.modifyClass(“service:composer”, {\>  
> save() {  
> const model = this.get(‘model’);  
> if (model.action === ‘createTopic’ || (model.action === ‘edit’)) {  
> const fileInput = document.getElementById(‘fileUpload’);
> 
> ```
> const file = fileInput.files[0];
> 
> if (file) {
> uploadImage(file).then(url => {
> // 커스텀 필드 값 설정
> model.set('topic_file_upload', url);
> 
> this._super(...arguments);
> }).catch(error => {
> console.log('error', error);
> });
> }
> }
> },
> });
> 
> ```

무엇을 놓치고 있는 걸까요? 도와주실 수 있나요?

감사합니다!
