Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

ToBase64

Guest
Apr 10, 2006 Apr 10, 2006
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?
TOPICS
Database access
1.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Deleted User
Apr 21, 2006 Apr 21, 2006
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 http://livedocs.macromedia.com/coldfusion/7/htmldocs/00000115.htm
to get started.
Translate
Community Expert ,
Apr 12, 2006 Apr 12, 2006
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



Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 12, 2006 Apr 12, 2006
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?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 12, 2006 Apr 12, 2006
I think you should make the following modifications:

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 13, 2006 Apr 13, 2006
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.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 13, 2006 Apr 13, 2006
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.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 15, 2006 Apr 15, 2006
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".
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 21, 2006 Apr 21, 2006
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.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 21, 2006 Apr 21, 2006
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 http://livedocs.macromedia.com/coldfusion/7/htmldocs/00000115.htm
to get started.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 25, 2006 Apr 25, 2006
LATEST
YES!!!!! Thanks, that fixed it right up!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources