php, mysql text upload 문제

sjpark의 이미지

텍스트를 열심히 입력했더니 75KB정도 되었습니다.

확인해보니, 서버로 75KB모두 전송되었습니다.

그런데, mysql QUERY를 보냈더니, text가 뚝 잘려서 입력되는 겁니다.

현재 mysql 최대 업로드 패킷 크기는 8MB인가.. 하튼 MP3파일을 업로드 할 수 있을 정도입니다.

그런데 text는 75kb를 올려도 잘려서 올라가요..

...ㅜㅠ

redbaron의 이미지

sjpark wrote:

그런데 text는 75kb를 올려도 잘려서 올라가요..
...ㅜㅠ

http://dev.mysql.com/doc/mysql/en/Storage_requirements.html

2^16 이니까 64k 정도?

MEDIUMTEXT 를 쓰시면.. 100k 까진 감당할 듯 합니다.

sjpark의 이미지

아차 실수로 말씀을 안드렸군요

longtext로 바꿨었어요;;

futari의 이미지

아무래도 정보를 조금 더 적어 주시는 것이 좋을 것 같습니다 :)

뭐, 다른 Text를 넣었을 경우에도 잘리는지... 와

항상 같은 용량에서 잘리는지... 와 같은 정보 말이지요.

query문도 적어 주시면 여러 분들이 빨리 답변을 해 드릴 수 있지 않을까요~

php는 string 길이 제한이 없으니 아마도 mysql 에 query하면서 생긴 문제일 가능성이 크고, 그것도 아니라면 escape 문자 처리 문제인 듯 싶습니다만...

우선, TEXT나 BLOB로 되어 있는지 보시고, 혹시나 그렇다면 LONGTEXT나 LONGBLOB을 사용하세요~ 그게 아니면,,, 자세한 정보를 ㅡㅡ;;

하여튼 정보를 더... :wink:

-------------------------
The universe is run by the complex interweaving of three elements: matter, energy, and enlightened self-interest.
- G'kar, Babylon 5

futari의 이미지

헛 ㅡ.ㅡ; 딴짓하면서 답글 달았더니 벌써 답이 ㅡㅡ;;

-------------------------
The universe is run by the complex interweaving of three elements: matter, energy, and enlightened self-interest.
- G'kar, Babylon 5

sjpark의 이미지

네, 신경써주셔서 감사합니다.

1. 코드를 첨부합니다.
ACTION파일에서는 여러가지 사전 처리(첨부파일 업로드, 텍스트 업로드 방식 결정 처리등)를 하는데, 데이타의 전송내용은 모두 올바르게 전송되었고, 변수에도 모든 값이 정확히 저장되었습니다.

SQL로 업로드하는 함수 입니다.

    function insert($record, $parent_tid="0") {
        $tid = $this->get_new_tid();
        if($tid == false) return false;
        if($parent_tid!=0) {
            $this->update_reply($parent_tid, "1");
        }

        $this->query = "INSERT INTO ".$this->table." (tid,parent_tid,uid,pwd,anony_pwd,title,text,pid,datetime) VALUES ("
            ."'$tid',"
            ."'$parent_tid',"
            ."'".mysql_escape_string($record[uid])."',"
            ."'".mysql_escape_string($record[pwd])."',"
            ."'".mysql_escape_string($record[anony_pwd])."',"
            ."'".mysql_escape_string($record[title])."',"
            ."'".mysql_escape_string($record[text])."',"
            ."'".mysql_escape_string($record[pid])."',"
            ."'".(empty($record[datetime])==true?date("Y-m-d G:i:s"):$record[datetime])
            ."')";
        $result = mysql_query($this->query, $this->db);
        if($result == false) {
            $this->add_err(mysql_error());
            return false;
        }
        $this->commit();
        return $tid;
    }

2. PHP와 Apahce, Mysql의 환경 설정
PHP에서 POST Maximum 사이즈는 8MB입니다.
Mysql에서 한 패킷의 최대 크기는 8MB로 입니다.
첨부파일 형태로 mp3(8메가 이하)는 업로드가 잘 되었습니다.
다만 첨부파일 업로드는 SQL의 LOAD_FILE을 사용해서 TEXT업로드와는 약간의 차이가 있습니다.

3. 잘리는 단위
매번 같은 위치에서 잘립니다.
전체 용량이 71KB인데 올려지는 크키는 7KB가 적은
64KB..(오잉? 이건 TEXT 형의 최대 크기인데;;이상하네)

4. TABLE의 해당 필드의 타입은 LONGTEXT로 바꾸었습니다.

sjpark의 이미지

이런 엄청난 실수를;;;;;

다른 테이블의 text타입을 바꿔놓고..
=0=;;

죄송합니다;;;;;;

테이블이 두개 있었는데

article
forum

forum걸 바꿔놓고
article에 넣는게 안된다고 하고 있었습니다;;

죄송합니다;;

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.