Please Enable JavaScript!
Mohon Aktifkan Javascript![ Enable JavaScript ]

내용에 올바르지 않은 코드가 다수 포함되어 있습니다. > 자유게시판

본문 바로가기
사이트 내 전체검색

자유게시판

제보 내용에 올바르지 않은 코드가 다수 포함되어 있습니다.

페이지 정보

본문

<code></code>로 몇가지 소스를 감싸고..  내용에 textarea를 넣었는데,  아래와 같이 글을 쓸수가 없네요

 

800595458_1567392871.8942.png

 

추천1 비추천0

댓글목록

profile_image

웹지기님의 댓글

웹지기 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 us 아이피 (173.♡.♡.136) 작성일

<code></code> 의 < > 아니고 [ ] 로 감싸 주셔야 합니다.

[code]
<?php
include "./_common.php";

$isUpload = is_uploaded_file($_FILES['file[]']['tmp_name']);

// SUCCESSFUL

if($isUpload) {

$ym = date('ym', G5_SERVER_TIME);

$data_dir = G5_DATA_PATH.'/editor/'.$ym;
$data_url = G5_DATA_URL.'/editor/'.$ym;

@mkdir($data_dir, G5_DIR_PERMISSION);
@chmod($data_dir, G5_DIR_PERMISSION);

    $tmp_name = $_FILES['tuieditorFile']['tmp_name'];
    $name = $_FILES['tuieditorFile']['name'];     

    $filename_ext = strtolower(array_pop(explode('.',$name)));
    $mime_result = ' '.@mime_content_type($tmp_name).@shell_exec('file -bi '. $tmp_name);     

    // thanks to @dewoweb
    if (!preg_match("/(jpe?g|gif|bmp|png)$/i", $filename_ext)) { // check file extension
        // error
        @unlink($tmp_name);

echo json_encode(array('success' => false, 'error' => 100)); // file type error
    } else if ( !stripos($mime_result, 'jpeg') &&                          // check file mime-type
        !stripos($mime_result, 'jpg') &&
        !stripos($mime_result, 'gif') &&
        !stripos($mime_result, 'bmp') &&
        !stripos($mime_result, 'png') ) {
        @unlink($tmp_name);
        echo json_encode(array('success'=> false, 'error' => 101));
    } else if (!getimagesize($tmp_name)) {                              // check image resolution, if resolutions is null, return fail
        @unlink($tmp_name);
        echo json_encode(array('success'=> false, 'error' => 102));
    } else { 
$file_name = sprintf('%u', ip2long($_SERVER['REMOTE_ADDR'])).'_'.get_microtime().".".$filename_ext;
        $save_dir = sprintf('%s/%s', $data_dir, $file_name);
$save_url = sprintf('%s/%s', $data_url, $file_name); 
        @move_uploaded_file($tmp_name, $save_dir);
        echo json_encode(array('success' => true, 'save_url' => $save_url ));
    }
} else {
$error = $_FILES['tuieditorFile']['error'];

// refer to error code : http://www.php.net/manual/en/features.file-upload.errors.php
// example) 1 is error for upload_max_filesize
echo json_encode(array('success'=> false, 'error' => $error));
}
?>
[/code]

profile_image

마젠토님의 댓글의 댓글

마젠토 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 us 아이피 (47.♡.♡.2) 작성일

글 내용입니다 뭐가 걸리는지 모르겠습니다.
[code]
예전에는 textarea를 사용했는데..



요즘은 div를 많이 사용하네요..



텍스트에리어를 쓰면 그누보드에서 넘어오고 쓰여지는 것이 쉽게 됩니다.



그래서 

텍스트에리어 스타일을 display:none으로 처리해서 그누보드와 주고 받게 되는 것 같습니다.

(class나 id로 서로 연결..)



다음은 에디터가 치고 들어 갔을 때의 CSS가 충돌나는 것이네요..



그리고 다음은 에디터에서 이미지 업로드하는 방식입니다.



기존의 upload.php (이것 저것 찾아보니 제일 많이 사용중.)  그런데 뭔지 잘 모름 ㅠㅠ



[code]

<?php

include "./_common.php";



$isUpload = is_uploaded_file($_FILES['file[]']['tmp_name']);

// SUCCESSFUL

if($isUpload) {

$ym = date('ym', G5_SERVER_TIME);



$data_dir = G5_DATA_PATH.'/editor/'.$ym;

$data_url = G5_DATA_URL.'/editor/'.$ym;



@mkdir($data_dir, G5_DIR_PERMISSION);

@chmod($data_dir, G5_DIR_PERMISSION);



    $tmp_name = $_FILES['tuieditorFile']['tmp_name'];

    $name = $_FILES['tuieditorFile']['name'];

    

    $filename_ext = strtolower(array_pop(explode('.',$name)));

    $mime_result = ' '.@mime_content_type($tmp_name).@shell_exec('file -bi '. $tmp_name);



    

    // thanks to @dewoweb

    if (!preg_match("/(jpe?g|gif|bmp|png)$/i", $filename_ext)) { // check file extension

        // error

        @unlink($tmp_name);

echo json_encode(array('success' => false, 'error' => 100)); // file type error

    } else if ( !stripos($mime_result, 'jpeg') &&                           // check file mime-type

        !stripos($mime_result, 'jpg') &&

        !stripos($mime_result, 'gif') &&

        !stripos($mime_result, 'bmp') &&

        !stripos($mime_result, 'png') ) {

        @unlink($tmp_name);

        echo json_encode(array('success'=> false, 'error' => 101));

    } else if (!getimagesize($tmp_name)) {                              // check image resolution, if resolutions is null, return fail

        @unlink($tmp_name);

        echo json_encode(array('success'=> false, 'error' => 102));

    } else {

        

$file_name = sprintf('%u', ip2long($_SERVER['REMOTE_ADDR'])).'_'.get_microtime().".".$filename_ext;

        $save_dir = sprintf('%s/%s', $data_dir, $file_name);

$save_url = sprintf('%s/%s', $data_url, $file_name);

        

        @move_uploaded_file($tmp_name, $save_dir);



        echo json_encode(array('success' => true, 'save_url' => $save_url ));

    }

} else {

$error = $_FILES['tuieditorFile']['error'];



// refer to error code : http://www.php.net/manual/en/features.file-upload.errors.php

// example) 1 is error for upload_max_filesize

echo json_encode(array('success'=> false, 'error' => $error));

}

?>

[/code]



업로드 쪽에서 ajax로 올리는 데..  파일을 하나씩 올려주면 되네요.. (Toast editor)



보통 PHP와 javascript로 할 경우에는 어떤식으로  디버깅하나요?  javascript는 브라우저 디버거로 어떻게든 찍어보고 있는데.

상단을 찍어 볼수 있는 방법을 모르겠네요..



기존 예제는 ajax와 php로 되어 있고, 마크다운 에디터는 xtmlHTTPRequest를 사용하네요.. (둘이 같은 것인지???)



갈수록 어렵네요..  일단 제작자에게 callback 펑션을 요청해 놨습니다.



업로드 성공하면. ![파일네임]을 리턴하면 실제로는 업로드된 이미지 링크를 붙여주면 될것 같습니다.

![파일네임](http:localhost/data/editor/1909/{시간}.jpg)



받은 배열을 한번에 올리면,  그것을 에디터에 넣는 것은 어떻게 할까요?



Toast UI는 하나씩 올릴때 마다 Callback 펑션이 있어서 에디터에 들어가는 String을 넘겨주는 것 같습니다.

![파일네임]을 넘겨주면 위쪽에서 뒤에 이미지 링크를 붙여주는 것이죠..

[/code]

일반 WYSIWYG에서는 그냥 <img src="링크">를 넣어주면 되겠죠..

profile_image

웹지기님의 댓글

웹지기 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 us 아이피 (173.♡.♡.136) 작성일

복붙해서 붙혀넣기하면 문제가 발생하나 봅니다. 에디터 플러스에서는 복붙해도 문제가 없는데 어떤 에디터를 사용 하시나요?

profile_image

마젠토님의 댓글의 댓글

마젠토 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 us 아이피 (47.♡.♡.2) 작성일

아파치존에서 그냥 타이핑한것입니다.

profile_image

Luck★Event님의 댓글의 댓글

no_profile Luck★Event 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 us 아이피 (173.♡.♡.136) 작성일

축하 드립니다. 웹지기님! Point 179점 Lucky Event 에 당첨 되셨습니다.

profile_image

웹지기님의 댓글의 댓글

웹지기 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 us 아이피 (173.♡.♡.136) 작성일

타이핑 하셨는데 저렇게 띄어쓰기가 심하게 된건가요????/

profile_image

마젠토님의 댓글의 댓글

마젠토 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 us 아이피 (47.♡.♡.2) 작성일

타이핑한것 저장된 것을 댓글에 카피한 것입니다.

profile_image

웹지기님의 댓글의 댓글

웹지기 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 us 아이피 (173.♡.♡.136) 작성일

댓글에 첨부하는 이미지 사이즈도 제한 해야 겠네요......ㅠㅠ

글쓰기 에디터에서는 코드 스니펫을 이용하시면 편합니다.

Total 1,518건 1 페이지
자유게시판 목록
번호 제목 글쓴이 조회 추천 비추천 날짜
공지 공지 웹지기 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 122638 9 0 10-31
1517 정보 no_profile 하하돌다리 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 22918 1 0 04-27
1516 토픽 no_profile 우는매미 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 35421 0 0 04-20
1515 토픽
그누보드 6 댓글1
no_profile 크랙보이 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 61329 0 0 03-26
1514 유머 no_profile 동수1122 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 67794 0 0 03-18
1513 토픽 아파치 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 60350 2 0 03-01
1512 정보 no_profile 하하돌다리 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 28006 1 0 02-28
1511 정보 no_profile 하하돌다리 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 23528 0 0 02-12
1510 토픽 아파치 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 22934 1 0 02-09
1509 정보 no_profile 하하돌다리 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 32356 0 0 01-26
1508 정보 no_profile 하하돌다리 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 31189 0 0 01-22
1507 정보 아파치 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 24650 0 0 01-17
1506 정보 no_profile 하하돌다리 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 22977 0 0 01-12
1505 정보 no_profile 하하돌다리 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 24676 0 0 01-09
1504 토픽 아파치 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 27023 0 0 12-31

검색

회원로그인

회원가입
QnA nanoomihost. dnsever. dnszi.

사이트 정보

포인트 정책
포인트 순위
사이트명 : 아파치존
개인정보관리책임자 : JOO SUNG

접속자집계

오늘
685
어제
11,247
최대
176,238
전체
3,655,087
Copyright © apachezone.com. All rights reserved.