Forum Discussion

JoeDrosen's avatar
Qrew Trainee
3 years ago

Pointer for Uploading Files into Quickbase via API

Short Version: When uploading a file attachment via the Quickbase API: the Base64 content should be on a continuous line and not contain any Carriage Returns or Line Feeds / aka CRLF (ASCII Character 13) and LF (ASCII Character 10). You may need to filter out these characters from your Base64 attachment to generate this result.

Long Version: Just wanted to post this here, as I spent an entire day trying to upload an image into Quickbase via the API. The response showed that the transfer was completed, but when I went to view the resulting URL, all I saw was a white square on a black background.

I opened a support ticket, where the QB tech verified that our XML request was correct and stated that he did some tests without issue, noting "My image uploaded when the string was all on the same line." The solution, my Base64 encoded file needs to be on a SINGLE LINE! It would have been helpful in the API Docs, that it is more clearly stated that Base64 text is supposed to be on the SAME LINE. I tried everything BUT removing the CRLF and LF characters from the Base64 content! Now that I did it, it works!

It appears that I was misreading the file management page (OVER AND OVER AND OVER). Here it states "You should not use MIME style encoding with newline characters at a maximum line length of 76." I read this as, you should not use MIME style encoding, but it should have newline characters to cause the line length to have a maximum of 76 characters. This was further supported in the Base64 Encoded File Attachment Example, where it seems to clearly show the data in lines of 76 characters. Looking at the example, I thought this meant that it WAS SUPPOSED to fit the standard 76 characters column width (as the sample request seemed to be formatted in a standard Base64 / 76 character max column.) It wasn't until today, that I counted the characters in the example & found out that the text was broken up into 75 characters.

I am submitting this as edits to the above pages, as well as posting this on in the case that this info isn't updated in a timely fashion. Perhaps this could help save someone else this confusion. I am asking that they clearly state that the "Base64 should be on ONE continuous LINE with NO CRLF or LF Characters to break the text". Also, editing the file attachment example to make it represent the data on a continuous line (ie: formatting the example in FULL PAGE WIDTH).

Joe Drosen

2 Replies

  • Thanks for your post.  I'm having this problem myself.  Did you solve this in JavaScript?  Can you provide an example of your replacement of new lines, or filtering of the characters?