Ask a Question related to Coldfusion Database Access, Design and Development.
-
James@nps #1
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
-
BKBK #2
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
-
James@nps #3
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
-
BKBK #4
Re: ToBase64
I think you should make the following modifications:
- fileField="uploadFile"
- destination="#ExpandPath(".")#\"
BKBK Guest
-
James@nps #5
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
-
James@nps #6
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
-
MikerRoo #7
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
-
James@nps #8
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
-
MikerRoo #9
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



Reply With Quote

