Types of Data Encoded in Base64

Within an application I am developing, there is a feature for downloading files that are stored as Base64 strings. It is essential to correctly pair the data types with the corresponding files in order to ensure successful downloads.

I thought I had sorted this out quite well. However, it appears that docx files are being downloaded as doc files and xlsx files as xls files. Is there a way to download these files in their proper file formats? Unfortunately, most of the websites that provide information on this topic are restricted by company policies.

For docx files, I currently have data:application/msword

and for xlsx files, I have data:application/vnd.ms-excel

Answer №1

When dealing with .xlst files, the correct MIME Type is:

application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

For .docx files, use the following MIME Type:

application/vnd.openxmlformats-officedocument.wordprocessingml.document

To learn more about the correct content-type for excel files, check out this helpful resource: What is correct content-type for excel files?

Referencing information from :

Ext    MIME Type
.doc   application/msword
.dot   application/msword
.docx  application/vnd.openxmlformats-officedocument.wordprocessingml.document
.dotx  application/vnd.openxmlformats-officedocument.wordprocessingml.template
.docm  application/vnd.ms-word.document.macroEnabled.12
.dotm  application/vnd.ms-word.template.macroEnabled.12
.xls   application/vnd.ms-excel
.xlt   application/vnd.ms-excel
.xla   application/vnd.ms-excel
.xlsx  application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
.xltx  application/vnd.openxmlformats-officedocument.spreadsheetml.template
.xlsm  application/vnd.ms-excel.sheet.macroEnabled.12
.xltm  application/vnd.ms-excel.template.macroEnabled.12
.xlam  application/vnd.ms-excel.addin.macroEnabled.12
.xlsb  application/vnd.ms-excel.sheet.binary.macroEnabled.12

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

My JSON request seems to be malfunctioning and I can't figure out why

I've generated a URL that I need to forward to the police data API. var api_url="http://policeapi2.rkh.co.uk/api/locate-neighbourhood?q="+latlon; document.write(api_url); The URL functions correctly when manually entered into a browser, but I requir ...

Steps for retrieving the identifier of a duplicated element

I've copied an element and changed their IDs, but I'm having trouble fetching the IDs of the cloned elements in jQuery. Can someone assist me with this issue? The HTML view source code is provided below: <table id="dataTable" borde ...

Troubleshooting Cache Problems in Express.js 4.0 during Development

Recently, I created a fresh express.js application using the express-generator. However, when I attempt to make modifications, none of them seem to reflect when I refresh the browser. I have tried various solutions found online, including: Disabling Chr ...

Trouble with CSS transitions not functioning while altering React state

Each time a user clicks on an accordion, the content should smoothly show or hide with a transition effect. However, the transition only seems to work when opening a closed accordion, not when closing an already open one! To get a clearer idea of this iss ...

Observing the element with a directive

I am working with the following code: angular.module("Test", []) .directive("testDirective", function () { return { restrict: "A", scope: { model: "=" } link: function(scope, element) { scope.$watch(function () { elem ...

Send a PHP array back to jQuery AJAX and dynamically populate a list using conditional statements

Looking to create a dynamic contact list that can be sorted using AJAX. When selecting one of the 3 menu options, a new list with updated information should be displayed. I've been doing some research but haven't come across useful information o ...

What is the best way to store data from multiple selected rows in different datagrids into a single state?

Programming Languages : JavaScript with React, Redux Toolkit, and Material-UI Issue : My goal is to synchronize the selection of checkboxes across multiple datagrids into one central state Attempts Made : I first attempted to manage checkbox selection fo ...

Only Chrome causing my JavaScript execution to freeze due to Ajax

When using Ajax, it is supposed to be asynchronous, but for some reason, it seems like it's either stopping or pausing my JavaScript execution and only resuming once the response is received. Here is an example of HTML value: <input value="foo" d ...

Error occurred in Flask due to request names being dynamically generated using JavaScript

My current project involves creating an app that calculates transit projections based on input years and other variables. I've written a JavaScript script where users can add new types of vehicles, each generating a unique div with specific ids and na ...

The function initFoodModel is missing and causing issues as it tries to read properties of undefined, specifically attempting to read 'findAll'

myWishlist.js const { setupFoodModel } = require("../../model/FoodModel"); const { setupWishlistModel } = require("../../model/myWishlistModel"); const setupMyWishlistModel = async () =\> { try { const sequelizeConnection = awai ...

Using props in the v-bind:src directive with Vue - a comprehensive guide!

I have a Vue application with a Block component that needs to display an image. The Block component is used multiple times in the App component, each time passing a value to determine which image src to choose from an array. When I try to print {{ this.Im ...

Is there a way to update page content without having to refresh the entire page?

My goal is to refresh specific content on a page without having to reload the entire page using JavaScript or jQuery. Since my project is built in PHP and JavaScript, I encountered this issue. Note : I want the page content to refresh when a user performs ...

Updating HTML images in real-time using a combination of Flask and Ajax

I am facing a situation similar to the one discussed in this thread: Flask+AJAX+Jquery+JINJA to dynamically update HTML Table. However, I am struggling to adapt the solution to suit my specific requirements. My objective is to automatically update the imag ...

Encountering an issue with NextJS useRouter when it is utilized within a function

I have encountered a puzzling issue that I can't seem to resolve. In my experimentation with NextJS, I am attempting to access the params in the router by utilizing the useRouter hook and integrating it with the querystring plugin to parse the asPath, ...

How can one save a text value element from a cascading list in ASP.NET MVC?

I have recently started learning about javascript, jquery, and ajax. In my model, I have defined the following classes: namespace hiophop.Models { public class CarMake { public class Category { public int CategoryID { g ...

Guide to retrieving and showing specific items from a DropDownList in a Text box using JavaScript, HTML, and AngularJS

Can someone explain how to extract and select items from a DropDownList and display them in a Textbox using JavaScript/HTML/AngularJS? Here are more details: I have a dropdown list with many items. When I click on an item from the list, it should be dis ...

Toggle the visibility of a div based on the id found in JSON data

I am looking to implement a JavaScript snippet in my code that will show or hide a div based on the category ID returned by my JSON data. <div id="community-members-member-content-categories-container"> <div class="commun ...

What is the process for crafting a Vuejs controlled input form?

Although I am familiar with creating controlled components in React using state, I am new to the Vue framework and would like to understand how to adapt my code from React to be compatible with Vue. My goal is to store the values of input fields in a data ...

Implementing multiple filters with jQuery

Make a Selection `<select class="form-control" id="technology"> <option name="sort" value="2g" id="2g"gt;2G</option> <option name="sort" value="3g" id="3g"&g ...

Looking to enhance the accessibility of a dynamically generated file by implementing the ability to expand and collapse sections as parent nodes

Currently working on a webpage where I am showcasing a testsuite file as the parent node and test cases within the testsuite file as child nodes. I have added checkboxes to both the parent and child nodes. Now, my goal is to include an ex ...