The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

The problem is that does not recognize extensions like .tar.gz. Any ideas on how to get .tar.gz and other 3 or 4 character extensions to be found?

I was thinking about just exploding the filename and using all but the first index in the array. Then join the other parts by a period but that would not work for something like: class.upload.php if you were allowing uploading of php files with naming like that. Since that would result in a file extension of .upload.php instead of .php.

Well, an extension is everything after the *last* dot, by definition. So in your example myfile.tar.gz, the extension is .gz and the file name is myfile.tar. The fact that .tar can also be an extension doesn't make it an extension in this particular case.

But, if for some reason you did want to get the tar part, then you would really need to compile a list of them to match against. However, there's no sure fire away of getting the "two" extensions and knowing it is an extension and not part of the file name without the extension.

There's no such way yes, simply because there are no second extensions -- there's only one. If you needed the .tar part, for example to extract files, you would need to analyse the filename; and for that you must recognize the .gz extension first, then act on it. But isn't it the same what you do with .gif or .jpg extenstions, as an example?

You need to compile a list of allowed file types anyway, not just allow users to indiscriminately upload any and all types. I strongly recommend trying not one but several MIME type checks before moving the uploaded file from /tmp into the publicly accessible space.