Extra Form
PHP PHP 7.2
CMS Rhymix


        $module_info = Context::get("module_info");
        $module_srl = $module_info->module_srl;
        $upfile= Context::get("upfile");
        $upload_target_srl = getNextSequence();
        $oFileController = getController('file');
        $output = $oFileController->insertFile($upfile, $module_srl, $upload_target_srl,0,true);

 

모듈에서 파일 업로드를 구현하려고 이렇게 만들었습니다.

업로드는 잘되는데, 업로드 상태가 유효가 아닌 대기에 있습니다..

 

어떻게 해야 유효로 만들수 있을까요?

 

+ 게시글 등록을 해야 파일이 업로드 되는건가요?

파일 업로드 관련 부분이 잘 이해가 안되는데,, 어떻게 작동 되는 건가요?

  • ?
    $upload_target_srl 는 file_srl (파일번호) 가 아니라
    이 파일이 소속되어있는 글 (document_srl) 나 댓글(comment_srl) 출처를 의미합니다.
    ( 다른 모듈기반이면 다른 기준이 있을 수 있겠죠. 어쨋든 이 글이 첨부되어있는 출처를 말합니다 )

    파일업로드는 기본적으로 대기상태가 됩니다.
    글의 경우 글이 등록되면서 ( document.insertDocument - after ) 트리거를 통해
    files 모듈의 triggerAttachFiles 가 실행되면서 대기 상태를 유효 상태로 전환합니다
    글 수정 / 댓글 등록 / 댓글 수정 모두 같은 원리입니다.
  • profile

    업로드된 파일은 기본적으로 대기 상태입니다.

    일단 insertFile을 하고 나서 아래의 함수를 실행해 주면 유효 상태로 변경됩니다.

    $oFileController->setFilesValid($upload_target_srl);