Re: Format of uploaded files
Re: Format of uploaded files
- Subject: Re: Format of uploaded files
- From: Robert Walker <email@hidden>
- Date: Tue, 13 Jan 2004 22:39:37 -0500
1. xyz.app : this is an application bundle.If the file is a folder
then it does'nt allow the user to upload because folder upload is not
possible.But what if the file is an application bundle.Its allowing
the user to upload the file though it is a directory.But the upload
file is a file and not the application bundle.But for the user, it
appears that the entire bundle got uploaded and when he tries to
download he find just a file.So is there any way by which we can
restrict bundle uploads too.
The only thing that understands a "bundle" is the Mac OS X Finder. To
everything else it's just a directory. Since, I assume, the standard
"Open" dialog box in Mac OS X uses the Finder to list the files you see
a single "File" for each "bundle."
Keep in mind that on UNIX (Including Darwin -- Mac OS X) everything in
the file system is treated as a file (including directories). A
directory is a special type of file that contains a list of other
files. A "bundle" is a special type of directory that the Finder
recognizes. The Finder then displays a single icon to represent the
"bundle."
I can't think of a way to prevent the user from selecting any bundles.
You could prevent upload of Application bundle by looking at the file
extension on the uploaded file. If it's a ".app" then throw an
exception or use another error handling technique.
The "kind" to which you keep referring, I assume, is that which is
shown in the Finder windows. The Finder uses some fairly complex
algorithms to determine a file's "kind." It goes something like (maybe
not exactly):
1. If the Type/Creator code is set in the HFS resource fork Finder uses
these code to determine "kind".
2. If the file is a "bundle" it looks for the info.plist to get the
type/creator codes from there.
3. If none of this is found it looks for a file extension and performs
a "lookup" from a list of known extensions.
4. If Finder cannot locate any of the above it tags the "kind" as
"Document."
Oh, by the way, if you are downloading a file from the Internet there
is also the mime-type which can be used to determine the files "kind."
I'm not exactly sure how this is accomplished, but I believe the
Internet Browser does it. I could be wrong.
In the end Cyril is exactly correct in saying that "a file is a file is
a file." It's just a bunch of bits. Information stored about the
"kind" of file is not stored in the file itself. It will be in a
resource fork on a multi-fork file system like HFS+, or in a completely
separate file on single fork systems like UFS, Windows, etc. In fact
in Windows it's not stored anywhere. Windows always determines type by
the file extension.
Hope this helps. Sorry for rambling.
On Jan 10, 2004, at 8:57 AM, Kranthi Sagar Borra wrote:
Hi Cyril,
Thanks for you respose.I tried the following files.I am working on MAC
OSXcan you please tell me if something is wrong on my side.
1. xyz.app : this is an application bundle.If the file is a folder
then it does'nt allow the user to upload because folder upload is not
possible.But what if the file is an application bundle.Its allowing
the user to upload the file though it is a directory.But the upload
file is a file and not the application bundle.But for the user, it
appears that the entire bundle got uploaded and when he tries to
download he find just a file.So is there any way by which we can
restrict bundle uploads too.
2. MyScript : .Its of the kind "compiled script".Its filename is just
MyScript and it doesnt have any extension.Its opened with Script
Editor by default.When this is uploaded it is getting uploading as of
kind "Document".And so when I download it , it is getting downloaded
as a document.can you please tell me where I am going wrong.
Regards,
Kranthi Sagar
----------
From: Cyril Godefroy
Sent: Saturday, January 10, 2004 5:30 PM
To: email@hidden
Subject: Re: Format of uploaded files
A file is a file is a file:
There is no such thing as a file type if you upload it. It's just a
bunch of bytes or a data. So the answer to your question is that
WebObjects supports all file types.
A file is also a name. In a name you'll find an extension which
usually
describes the file type. If you save the array of bytes in a file
which
has a nice name with a nice extension, it will inherit the type. Even
if you save an empty array of bytes in a file with an extension, it
will have a type (at least on OS X and Windows).
You'll have to give more details regarding the issue you are facing,
such as: OS, file types uploaded, file names used to save the files.
Examples would be a plus.
Cyril
On 10 janv. 04, at 10:59, Kranthi Sagar Borra wrote:
Hi
I am using the http streamlining functionality to upload files.When I
upload files of type "compiled scripts", they are getting stored as
type "Document".Is this file type not supported by webobjects.The
same
happened with some other file formats too.Can somebody please tell
me
what are the supported formats and how are the files with the
unsupported formats saved.Thank you.
Thanks,
kranthi
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
--
Sincerely,
Robert Walker
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.