If you're using a website with a form that allows you to upload files directly from Safari, you might occasionally encounter this message:
POSIX error: Is a directory (NSPOSIXErrorDomain:21)
A "directory" is another term for a folder, and you can't upload folders in this scenario without first converting the folder to a single file (more on that in a second). Some files that don't look like folders in the Finder really are folders which are not used as such by you, so the Finder hides their folder status by default to make your life easier. Examples of this include application packages, Pages documents, RTFD documents, and Keynote presentations.
When you see the message above, the first thing you should do is double check that you selected the correct item. After that, you need to convert it to an "archive," which is a compressed version of the file or folder which will behave as a single file.
In the Finder, select the document or application that you want to compress. From the File menu, choose Create Archive. A compressed archive of the selected item will appear in the same folder as the original. It will have the same name as the original, but with ".zip" added to the end.
Tip: If you archive multiple items at once, the archived file is named "Archive.zip". To un-archive a zipped file, just double-click on it in the Finder.