filetype

How do I tell if someone's faking a filetype? (PHP)

I'm programming something that allows users to store documents and pictures on a webserver, to be stored and retrieved later. When users upload files to my server, PHP tells me what filetype it is based on the extension. However, I'm afraid that users could rename a zip file as somezipfile.png and store it, thus keeping a zip file on m...

how to detect if a URL points to a SWF

Is there a way (preferrably using JavaScript) to determine whether a URL is to a SWF or a JPG? The obvious answer is to sniff the filename for ".jpg" or ".swf" but I'm dealing with banners that are dynamically decided by the server and usually have a lot of parameters and generally don't include an extension. so i'm wondering if I co...

Find out the real file type

I am working on an ASP web page that handles file uploads. Only certain types of files are allowed to be uploaded, like .XLS, .XML, .CSV, .TXT, .PDF, .PPT, etc. I have to decide if a file really has the same type as the extension shows. In other words if a trojan.exe was renamed to harmless.pdf and uploaded, the application must be a...

What are the most common virus file types currently circulating?

I am working on a project that will involve file upload to a server. I am interested in understanding what kinds of files virus writers currently tend to target. I am aware of the following threads: How would you programmatically test a file for viruses ? ensuring uploaded files are safe How can I determine a file’s true extension/type ...

How do I get File Type Information based on extention? (not MIME) in c#

Hi. How do I get the general File type description based on extention like Explorer does it? So not MIME but the information that the end-user sees, like. .doc = Microsoft Office Word 97 - 2003 Document .zip = ZIP File .avi = Video File. And how can I get the 'secondary' information that seems to be available, which I guess it not ext...

File type indicator, sys/stat.h st_mode regular file code value

I am trying to identify file types for directory entries (Windows Unix etc..). In sys/stat.h the high order nybble of the st_mode word have the coded values: #define S_IFDIR 0x4000 /* directory */ #define S_IFIFO 0x1000 /* FIFO special */ #define S_IFCHR 0x2000 /* character special */ #define S_IFBLK 0x3000 /* block special */ ...

how to use htaccess to disguise filetypes

I want to be able to name my files with whatever extension I choose. In this case let’s use .foo, and then process them as PHP files. Right now my .htaccess looks like this AddType application/x-httpd-php .foo But it doesn’t work, it still prompts me to download the file when I access it. Any advice or tips? ...

Very strange behavior with Vim syntax and filetype detection

I have a file, called WrongFileTypeDetection.R, containing the following text: # This file is sometimes wrongly detected as a conf file I also have two versions of _vimrc, that I would have thought to be absolutely identical. However, when I use the first version, the above file is incorrectly detected as a "conf" file, even though I...

Check Upload file type from an array in PHP.

Hi, I know this has been asked a few times before. However, it's something I've had a problem with for a long time. How can I check if a file extension and mime type are in an array this is the code I currently have. $upload_project_thum = $_FILES['upload_project_thum']['name']; $upload_project_thum_ext = substr($upload_project_thum...

How to configure Telelogic Synergy so that the default type for "unknown" file is binary rather than ascii ?

Hi, if I am not wrong, Telelogic Synergy mapped new files to a type depending of their extensions. If the extension is unknown, the file is by default declare as a base type ascii. Is it possible to make sure that "unknown" file type end up as binary rather than ascii ? Thanks, Thomas ...

What do .c and .h file extensions mean to C?

It's all in the title; super-simple I reckon, but it's so hard to search for syntactical things like things anywhere. These are two library files I'm copying from the web, and I'm wondering why they're called two different names From here: CS50.net ...

How to check if a file is a DLL?

Given a file, I want to check if this is a DLL, or a shared object (Linux) or a dylib (Mac OS X), or something different. My main interest is differentiating executable and DLL on Linux and Mac OS X. For windows, the extension should be enough for my problem. I already checked that the magic number technique doesn't work for Linux as ex...

File structure explorer (sth like Wireshark, but for files)

Hi I am looking for a software which is able to decompose and analyze files. Do you know any? What I mean is something that, given a file, would tell me for example: here is the magic number telling that it is a PNG, and here starts a colors definition, here goes the compression flag, and then there are the picture data, and so on......

Indicate programming language in a file without extension

When writing executable scripts, and declarative configuration files that use a common language (eg. Python), I often find it undesirable to add an extension to the file name. Many syntax-highlighting text editor (eg. Geany) are subsequently unable to automatically determine the filetype. Is there any standard method for indicating to e...

Associate file type/extension to non document based cocoa application

This is for some reason really hard to find and solve. Cannot find any documentation on it. I've got a non-document based application which I would like to open all specific file types, but I do not want to use NSDocuments but let my code handle the opening of file and processing of it. I've added the CFBundleTypeExtensions and all, sett...

svn diff: file marked as binary type

I'm doing an svn diff on one of my files and svn is detecting it as a binary type. The file is readable plain text and I would like to be able to get a diff of this file. How do I tell SVN that this is not a binary file? Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream ...

What file format contents starts with "URES"?

I have a number of files that contain data in a format I am not familiar with. All of the data files begin with the same byte sequence, presumably a file header, and the sequence is "URES". I'm assuming that these files are some kind of resource file, perhaps a collection of data or other files all embedded into one file; that's just a...

Problem getting the full path of the file uploaded using HTML inputfile type to read the content of the file.

Hi, I would like to use HTML input file type in my aspx page to allow user to browse for a excel file and then read the content of the excel sheet programmatically.If I want to read the excel sheet I need the full path of the file to connect to the excel sheet using asp.net.I do not understand how can I get the full path of the file. I ...

Best way to organize filetype settings in .vim and .vimrc?

I'm going through my vim dotfiles to tidy them up. I've noticed that through time I've added various filetype specific settings in various inconsistent ways. Let's suppose I'm customizing for Python: au BufRead,BufNewfFile *.py (do something). I don't like this because some Python files might not have the .py termination. au FileType ...

PHP find if file data is an image

Imagine I have some file data in a variable $data. I need to determine whether it is an image or not. No need for details such as corrupt images etc. Firs thought would be getting the file mime type by looking at the magic number and then see whether "image" is in the mime type. No such luck, even if I have a "file extension to mime ty...