Preview for sql attachments
Asked by Tor Brondbo:

I want to add preview for .sql attachments. Preview like .txt files is OK.

Is there any way to add this?


Answers:
author: Mirek
body: Add a ".txt" extension and upload to confluence. For example if you file is "exampleSQL.sql" then rename to "exampleSQL.sql.txt". When you would like to use the file download and remove "txt".

comments: author: Tor Brondbo
body: If you don't know the answer to the question, why reply?


author: Mirek
body: [@Tor Brondbo](/t5/user/viewprofilepage/user-id/291174)- Let me clarify. You asked a question how to view SQL files that you attach to Confluence to be viewable like TXT files for example. I gave you one one the solutions (workarounds) to achieve that, so that you can preview file without downloading it. Simply treat it as a text file (which .sql files are just with different extension). This is how I understand your question. If you do not like that solution or it is not answering your question that is completely fine. Here on Community people ask questions and there are not always 100% perfect solutions or suggestions. Sometimes those do not simply exist. I gave you an idea, maybe someone else have their own solution (and will post it) and if you like it better you can later "Accept as a solution" that is next to every reply. Thanks to that we can gratuitously share ideas with each other . If you pay for maintenance you can go directly with your questions to Atlassian support or create an improvement/suggestions request on <https://jira.atlassian.com/> if the feature do not exist in current version of the application.


author: Tor Brondbo
body: Well, I didn't, I asked a question about how to get preview of .sql files attached to Confluence, i.e. files with the extension '.sql'.


author: Mirek
body: So, in that case you cannot (using standard OOTB functions without any plugin or workaround). Some time ago it was not even possible to preview .txt files... People would like to also have a preview of , js, .java, .ods, .msg, .html .. you would like to have .sql but this is not currently supported (only - JPEG /DOC/PDF/PNG/DOCX/TIFF/PPT/PSD/PPTX/WMF/XLS/EMF/XLSX/ICO/ICNS)

For others users that would like to see the workaround that I propose in action, this is how preview looks in Confluence. I hope it helps someone.

![sql_files.png](https://community.atlassian.com/t5/image/serverpage/image-id/25985i2FF36E4A41BC57FB/image-dimensions/575x260?v=v2 "sql_files.png")


author: Adam Dylla
body: I've found that if you edit the Properties of the attachment and set the mime type to 'text/plain', then via the attachments view (click the paper clip icon at the top above the page title) then when you click on the item it will preview as a text file. Note this still does not make it work via the main page links.

We were able to use the Attachment macro and added file comments to the files and it works well enough.

comments: author: Robert Ross
body: This is not working for me at all. I fully expected this to work the second I saw the "New Content Type" with a MIME specification in it. However, it still says it cannot preview.

![download.png](https://community.atlassian.com/t5/image/serverpage/image-id/186152i01E7946932A61CA1/image-size/large?v=v2&px=999 "download.png")![download.png](https://community.atlassian.com/t5/image/serverpage/image-id/186153i4F08BA5A7879CAE0/image-size/large?v=v2&px=999 "download.png")


author: Joshua Littlefield
body: I did this on 6 .sql attachments where I had this issue. After a little while (not sure if time is needed), when I click on them from the attachments display, 3 of them display as text, while the other three still say they can't preview. I can't determine anything different between the ones where it worked and those where it did not.


Tags: attachment

confluence-server

preview

server