1. SinaEditor 다운로드
2.JSP 호출 페이지
다음과 같이 코드 코드를 복사합니다.
<textarea name="problemBody" id="content" style="display:none;" 텍스트 영역>
<iframe src="<%=request.getContextPath() %>/edit/editor.htm?id=content&ReadCookie=0"frameBorder="0" marginHeight="0" marginWidth="0" scrolling="No">< /iframe>
그 중 src="<%=request.getContextPath() %>/edit/editor.htm은 다운로드한 SinaEditor의 editor.htm 파일 경로를 나타내며 녹색으로 표시된 두 ID는 일치해야 합니다.
3. 다운로드한 편집기에는 img.htm과 attachment.htm이 포함되어 있습니다. 첫 번째는 사진 업로드용이고 두 번째는 첨부 파일 업로드용입니다. 물론 둘 다 동일한 방식으로 사용되며 파일 업로드로 간주할 수 있습니다.
4. 다음은 img.htm에 이미지를 업로드하는 예입니다. 나중에 사용할 수 있도록 메모해 두세요.
다음과 같이 코드 코드를 복사합니다.
함수 chk_imgpath() {
if($('radio1').checked==true){
if($("imgpath").value == "http://" || $("imgpath").value == "") {
window.close();
반품;
}
LoadIMG($("imgpath").value);
}또 다른{
if($("file1").value == "") {
Alert("이미지 파일 업로드를 선택해주세요!");
반품;
}
var 파일 경로 = j("#file1").val();
var filetype = filepath.substring(filepath.lastIndexOf('.'));
var regu = ".gif.jpg.png.jpge.GIF.JPG.PNG";
if (regu.indexOf(filetype) == -1) {
Alert('.gif.jpg.png.jpge 형식의 파일만 업로드할 수 있습니다!');
반품 ;
}
var f = j('#form1');
j.ajaxFileUpload({
유형: '포스트',
보안 : 거짓,
파일요소ID: 'file1',
URL: '/ask/fileUpload?type=img',
데이터 유형: '문자열',
성공 : 함수(데이터){
j("#imgpath").attr("value",data);
j("#radio1").attr("checked","true");
chk_imgpath();
$('divProcessing').style.display='';
},
오류: 함수(데이터){
Alert('파일 업로드 실패');
}
});
}
}
5. 백엔드 코드 작성(설명 없음)