asp.net SmartEditor 2.1.1 적용 소스

asp.net SmartEditor 2.1.1 적용 소스

스마트 에디터 2.1.1 다운로드

http://dev.naver.com/projects/smarteditor/download

asp.net 프로젝트 생성(naver01로 생성했음) 첨부 파일 참고

smartedtor2.1_aspnet_v2.zip

프로젝트 se 디렉토리에 복사.

/se/popup/quick_photo/FileUploader.aspx 생성및 작성

private string UploadDir = "/UploadFiles/"; // Upload dirctory

// 이미지 파일을 서버에 저장하고 저장한 정보를 클라이언트에 보내줌.

protected void Page_Load(object sender, EventArgs e)

{

if (!IsPostBack)

{

HttpFileCollection uploadedFiles = Request.Files;

string callback_func = Request.Form["callback_func"];

// 다수의 파일을 다운로드 하여 파일을 저장함

for (int j = 0; j < uploadedFiles.Count; j++)

{

HttpPostedFile userPostedFile = uploadedFiles[j];

// 파일 내용이 있을경우

if (userPostedFile.ContentLength > 0)

{

string fileName = Path.GetFileName(userPostedFile.FileName);

string fileUrl = UploadDir + fileName; // 업로드 디렉토리 + 파일명.

// 파일 저장 (같은 파일명일경우 에러 처리 필요)

userPostedFile.SaveAs(Server.MapPath(fileUrl));

// 클라이언트에 저장한 파일 정보를 보내 줌

string returnUrl = string.Format("callback.html?callback_func={0}&bNewLine;=true&sFileName;={1}&sFileURL;={2}",

callback_func, fileName, fileUrl);

Response.Redirect(returnUrl);

}

}

}

}

/se/popup/quick_photo/QuickPhotoPopup.js 수정

function callFileUploader (){

oFileUploader = new jindo.FileUploader(jindo.$("uploadInputBox"),{

sUrl: location.href.replace(/\/[^\/]*$/, '') + '/FileUploader.aspx', // FileUploader.aspx 경로

/se/popup/quick_photo/callback.html 수정

document.domain = location.protocol + "//" + location.host; // 자기 서버 URL

/Write.aspx 생성 및 작성

제일 상단 내용에 ValidateRequest="false" 추가.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Write.aspx.cs" Inherits="naver01.Write" %>

를 아래와 같이

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Write.aspx.cs" Inherits="naver01.Write" ValidateRequest="false" %>

나머지는 소스 참고.

web.config 설정 파일에 아래내용 추가

참고 URL

http://dev.naver.com/projects/smarteditor/tech/39360

환경 visual stodio 2010, SmartEditor 2.1.1

smartedtor2.1_aspnet_v2.zip

from http://fehead.tistory.com/172 by ccl(A)

댓글

이 블로그의 인기 게시물

🐱‍💻Installing IIS Components Windows 10

2017년 1월 스타트업에서 구인할때 주로 원하는 개발 기술

Creating Cascading DropDownLists in ASP.Net (연속적인 셀렉트박스...