Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default ToBase64

    I am still having trouble with this tag. Any file over 46.8KB gets cut off to this size. Is there a size limitation for this tag?
    James@nps Guest

  2. #2

    Default Re: ToBase64

    Any file over 46.8KB gets cut off to this size. Is there a size limitation for
    this tag?
    If there is, it will surely be much higher than 46 KB. I think the problem
    comes from elsewhere.

    The following code runs successfully, execution time 80 ms. The result is

    photo file length: 781.00 kB
    photo file to base 64 length: 1,041.33 kB




    <cffile action = "ReadBinary" file =
    "C:\CFusionMX7\wwwroot\cflogintest\ngwe8.jpg" variable = "photo">
    <cfset photoToBase64 = ToBase64(photo)>
    photo file length: <cfoutput>#decimalformat(Len(photo)/1024)#</cfoutput> kB
    <br>
    photo file to base 64 length:
    <cfoutput>#decimalformat(Len(ToBase64(photo))/1024)#</cfoutput> kB

    BKBK Guest

  3. #3

    Default Re: ToBase64

    Here is my bit of bad code:
    <cffile action="upload" fileField="form.uploadFile"
    destination="#ExpandPath(".")#" nameConflict="OVERWRITE">
    <cfdump var="#cffile#"><!--- output data for testing --->
    <cffile action="readBinary" file="#file.serverDirectory#\#file.serverFile#"
    variable="myFile"><!--- read file into binary stream --->
    <cfset tobase = ToBase64(myFile)>
    <cfoutput>#decimalformat(Len(ToBase64(tobase))/1024)#</cfoutput> kB

    <!--- <cfif cffile.fileSize LT 46000>--->
    <cfquery name="insertFile" datasource="KFS"><!--- insert to DB --->
    SET TEXTSIZE 1000000
    INSERT INTO TestUpload(fileName, fileType ,subType, fileData, fileSize)

    VALUES('#cffile.serverFile#','#cffile.contentType# ','#cffile.contentSubType#','#
    tobase#','#cffile.fileSize#'
    )
    </cfquery>

    I see using your output line that the tobase64 is working. But when I retrive
    it from the DB it is always 46.8KB. So the trouble must be in the DB. I have
    the table set to hold "text" and belive it should hold up to 2 gig? any ideas
    why my file is getting cut short?

    James@nps Guest

  4. #4

    Default Re: ToBase64

    I think you should make the following modifications:

    - fileField="uploadFile"
    - destination="#ExpandPath(".")#\"


    BKBK Guest

  5. #5

    Default Re: ToBase64

    Thanks for yout time and help but the above change made no diffrence. I have
    been googling around for days, I am now looking into READTEXT and SET TEXTSIZE.
    It sounds like be database will cut output short. I am still having trouble I
    cant seem to get these to work in sql statements. Well back to the docs.

    James@nps Guest

  6. #6

    Default Re: ToBase64

    I think I have found the trouble. This is from the SQL help doc's.

    "The DB-Library variable DBTEXTLIMIT also limits the size of text data
    returned with a SELECT statement. If DBTEXTLIMIT is set to a smaller size than
    TEXTSIZE, only the amount specified by DBTEXTLIMIT is returned."

    Not sur ehow to change this limit, I do this:
    DBTEXTLIMIT 2000000
    and get a stored procedure not found error. If it is not one thing it is
    another.

    James@nps Guest

  7. #7

    Default Re: ToBase64

    You don't want to mess with DBTEXTSIZE or DBTEXTLIMIT.

    Check your datasource in CF administrator.
    Make sure that you have CLOB and BLOB checked under "Advanced settings".
    MikerRoo Guest

  8. #8

    Default Re: ToBase64

    I still have this problem. I had to move on to other stuff but will be coming
    back to this very soon.

    "Check your datasource in CF administrator.
    Make sure that you have CLOB and BLOB checked under "Advanced settings". "

    I am using MSSQL and when making tables do not see the option for CLOB or
    BLOB. only Image and Text. The macromedia site had a table that showed no
    support for BLOB with MSSQL. Did I miss somthing? I would gladly use BLOB if I
    could.

    James@nps Guest

  9. #9

    Default Re: ToBase64

    Coldfusion supports BLOB and CLOB with MS SQL.

    This is not set when you create a table, this is set when you create or edit a
    data source.

    Do not use dreamweaver for this. Use the CF Administrator.
    See [url]http://livedocs.macromedia.com/coldfusion/7/htmldocs/00000115.htm[/url]
    to get started.

    MikerRoo Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139