Getting the real mime type in a renamed file











up vote
2
down vote

favorite












I have a problem finding out what is the real mime type of a file whose name and extension was changed. For example, the file "app.exe" renamed to "picture.png" or "document.pdf", how can I get that the real mime type is ".exe"?



Thanks for your help.



Regards,










share|improve this question
























  • Check out the file signature ("magic" bytes at the very beginning of the file). Plain text files (note: csv files are plain text files) do not have it.
    – Kling Klang
    Nov 7 at 11:59












  • Thanks for answering! Very useful information about magic bytes. But, how can I verify that a plain text file is really a plain text file?
    – DanSC
    Nov 7 at 14:21












  • Well, if all the magic signatures you checked do not match, then it's probably a plain text file. As I said, csv data files and programming source files (including batch/scripts but excluding markup languages) are indistinguishable from actual texts.
    – Kling Klang
    Nov 7 at 15:33

















up vote
2
down vote

favorite












I have a problem finding out what is the real mime type of a file whose name and extension was changed. For example, the file "app.exe" renamed to "picture.png" or "document.pdf", how can I get that the real mime type is ".exe"?



Thanks for your help.



Regards,










share|improve this question
























  • Check out the file signature ("magic" bytes at the very beginning of the file). Plain text files (note: csv files are plain text files) do not have it.
    – Kling Klang
    Nov 7 at 11:59












  • Thanks for answering! Very useful information about magic bytes. But, how can I verify that a plain text file is really a plain text file?
    – DanSC
    Nov 7 at 14:21












  • Well, if all the magic signatures you checked do not match, then it's probably a plain text file. As I said, csv data files and programming source files (including batch/scripts but excluding markup languages) are indistinguishable from actual texts.
    – Kling Klang
    Nov 7 at 15:33















up vote
2
down vote

favorite









up vote
2
down vote

favorite











I have a problem finding out what is the real mime type of a file whose name and extension was changed. For example, the file "app.exe" renamed to "picture.png" or "document.pdf", how can I get that the real mime type is ".exe"?



Thanks for your help.



Regards,










share|improve this question















I have a problem finding out what is the real mime type of a file whose name and extension was changed. For example, the file "app.exe" renamed to "picture.png" or "document.pdf", how can I get that the real mime type is ".exe"?



Thanks for your help.



Regards,







android file mime-types






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 7 at 11:57









Kling Klang

32k156286




32k156286










asked Nov 7 at 7:26









DanSC

111




111












  • Check out the file signature ("magic" bytes at the very beginning of the file). Plain text files (note: csv files are plain text files) do not have it.
    – Kling Klang
    Nov 7 at 11:59












  • Thanks for answering! Very useful information about magic bytes. But, how can I verify that a plain text file is really a plain text file?
    – DanSC
    Nov 7 at 14:21












  • Well, if all the magic signatures you checked do not match, then it's probably a plain text file. As I said, csv data files and programming source files (including batch/scripts but excluding markup languages) are indistinguishable from actual texts.
    – Kling Klang
    Nov 7 at 15:33




















  • Check out the file signature ("magic" bytes at the very beginning of the file). Plain text files (note: csv files are plain text files) do not have it.
    – Kling Klang
    Nov 7 at 11:59












  • Thanks for answering! Very useful information about magic bytes. But, how can I verify that a plain text file is really a plain text file?
    – DanSC
    Nov 7 at 14:21












  • Well, if all the magic signatures you checked do not match, then it's probably a plain text file. As I said, csv data files and programming source files (including batch/scripts but excluding markup languages) are indistinguishable from actual texts.
    – Kling Klang
    Nov 7 at 15:33


















Check out the file signature ("magic" bytes at the very beginning of the file). Plain text files (note: csv files are plain text files) do not have it.
– Kling Klang
Nov 7 at 11:59






Check out the file signature ("magic" bytes at the very beginning of the file). Plain text files (note: csv files are plain text files) do not have it.
– Kling Klang
Nov 7 at 11:59














Thanks for answering! Very useful information about magic bytes. But, how can I verify that a plain text file is really a plain text file?
– DanSC
Nov 7 at 14:21






Thanks for answering! Very useful information about magic bytes. But, how can I verify that a plain text file is really a plain text file?
– DanSC
Nov 7 at 14:21














Well, if all the magic signatures you checked do not match, then it's probably a plain text file. As I said, csv data files and programming source files (including batch/scripts but excluding markup languages) are indistinguishable from actual texts.
– Kling Klang
Nov 7 at 15:33






Well, if all the magic signatures you checked do not match, then it's probably a plain text file. As I said, csv data files and programming source files (including batch/scripts but excluding markup languages) are indistinguishable from actual texts.
– Kling Klang
Nov 7 at 15:33














1 Answer
1






active

oldest

votes

















up vote
1
down vote













Check this answer. The main idea - all files have their type inside themselves. It means that you can read first bites and use this information to identify filetype and manually add extension or do whatever you want.






share|improve this answer





















  • Hi! Thank you very much for the information, I have advanced a lot in solving the problem using the magic bytes to identify the filetype.
    – DanSC
    Nov 7 at 14:24











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53185085%2fgetting-the-real-mime-type-in-a-renamed-file%23new-answer', 'question_page');
}
);

Post as a guest
































1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
1
down vote













Check this answer. The main idea - all files have their type inside themselves. It means that you can read first bites and use this information to identify filetype and manually add extension or do whatever you want.






share|improve this answer





















  • Hi! Thank you very much for the information, I have advanced a lot in solving the problem using the magic bytes to identify the filetype.
    – DanSC
    Nov 7 at 14:24















up vote
1
down vote













Check this answer. The main idea - all files have their type inside themselves. It means that you can read first bites and use this information to identify filetype and manually add extension or do whatever you want.






share|improve this answer





















  • Hi! Thank you very much for the information, I have advanced a lot in solving the problem using the magic bytes to identify the filetype.
    – DanSC
    Nov 7 at 14:24













up vote
1
down vote










up vote
1
down vote









Check this answer. The main idea - all files have their type inside themselves. It means that you can read first bites and use this information to identify filetype and manually add extension or do whatever you want.






share|improve this answer












Check this answer. The main idea - all files have their type inside themselves. It means that you can read first bites and use this information to identify filetype and manually add extension or do whatever you want.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 7 at 7:39









Arthur

345210




345210












  • Hi! Thank you very much for the information, I have advanced a lot in solving the problem using the magic bytes to identify the filetype.
    – DanSC
    Nov 7 at 14:24


















  • Hi! Thank you very much for the information, I have advanced a lot in solving the problem using the magic bytes to identify the filetype.
    – DanSC
    Nov 7 at 14:24
















Hi! Thank you very much for the information, I have advanced a lot in solving the problem using the magic bytes to identify the filetype.
– DanSC
Nov 7 at 14:24




Hi! Thank you very much for the information, I have advanced a lot in solving the problem using the magic bytes to identify the filetype.
– DanSC
Nov 7 at 14:24


















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53185085%2fgetting-the-real-mime-type-in-a-renamed-file%23new-answer', 'question_page');
}
);

Post as a guest




















































































這個網誌中的熱門文章

Tangent Lines Diagram Along Smooth Curve

Yusuf al-Mu'taman ibn Hud

Zucchini