개발 Q&A

제목 ckeditor 값이 동작하지 않고 callback 함수가 null값이 뜹니다ㅜㅜ
카테고리 서버
글쓴이 nhy7840 작성시각 2019/09/05 16:11:17
댓글 : 0 추천 : 0 스크랩 : 0 조회수 : 7895   RSS

첨부파일이 제 코드인데 자꾸 null값이 떠서 하루종일 이것만 가지고 시간을 보내고 있어요 ㅜㅜㅜ 도와주세요ㅜㅜㅜ코드는

@Controller

public class ImageUploadController {

   

   @ResponseBody

   @RequestMapping(value="imageUpload", method=RequestMethod.POST)

   public void imageUpload(HttpServletRequest request, 

         HttpServletResponse response, 

         @RequestParam MultipartFile upload)

            throws Exception {

   

      //http header 설정

      response.setCharacterEncoding("utf-8");

      response.setContentType("text/html;charset=utf-8");

      //http body

      //업로드한 파일 이름

      String fileName=upload.getOriginalFilename();

      //바이트 배열로 변환

      byte[] bytes=upload.getBytes();

      //이미지를 업로드할 디렉토리(배포 경로로 설정)

      String uploadPath = request.getSession().getServletContext().getRealPath("/resources/img/upload");

      System.out.println("uploadPath  "+ uploadPath);

      OutputStream out=new FileOutputStream(new File(uploadPath+fileName));

      //서버에 저장됨

      out.write(bytes);

      String callback= request.getParameter("CKEditorFuncNum");

      System.out.println("callback : "  + callback);

      PrintWriter printWriter = response.getWriter();

      String fileUrl = request.getContextPath()+"/resources/img/upload/"+fileName;

//      fileUrl = fileUrl.replace('\\', '/');

//      fileUrl = "/project/resources/img/제목 없음.png";

      

      System.out.println("fileUrl: "+fileUrl);

      System.out.println(out);

//      printWriter.println("<script>window.parent.CKEDITOR.tools.callFunction("+callback+",'"+fileUrl+"','이미지가 업로드 되었습니다.')"+"</script>");

      printWriter.println("<script>window.parent.CKEDITOR.tools.callFunction("+callback+",'"+fileUrl+"','이미지가 업로드 되었습니다.')"+"</script>");

      System.out.println("<script>window.parent.CKEDITOR.tools.callFunction("+callback+",'"+fileUrl+"','이미지가 업로드 되었습니다.')"+"</script>");

      //스트림 닫기

      printWriter.flush();

   }

}

 

이거입니다 전문가분들 도와주세요ㅜㅜ!!


첨부파일 ckeditor.PNG (365.9 KB)
 다음글 소스를 새로운서버에 복사해서 가져왔는데 404에러가 뜹... (3)
 이전글 안드로이드 스튜디오 푸시알림

댓글

없음