you can't do it with coldfusion since it's server-side.

you could always upload the file, determine the MIME type then do a MOVE
based on that.

-----Original Message-----
From: ArteCom Support [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 18, 2001 8:57 AM
To: CF-Server
Subject: Tr: mime type


Thanks for your reply but i nee to know the mime type or extension
before the <cffile action="upload"...
because destination folder and filename (+id from the database record
previously inserted) depends of that.

J�r�me


----- Original Message -----
From: Dave Watts
To: '[EMAIL PROTECTED]'
Cc: '[EMAIL PROTECTED]'
Sent: Tuesday, September 18, 2001 5:51 PM
Subject: RE: mime type


> Is it possible to know the mime type of an uploaded file ?
> Or to get his extension ?
>
> when i read the value of file field, i got
> "C:\WINNT\TEMP\ACF02.tmp", so i don't have the extension
> and i don't know how to get the mime type !

After you process the file upload with CFFILE ACTION="UPLOAD", you'll
have a
bunch of variables available to you in the File scope:

attemptedServerFile
 Initial name ColdFusion used when attempting to save a file

clientDirectory
 Directory location of the file uploaded from the client's system

clientFile
 Name of the file uploaded from the client's system

clientFileExt
 Extension of the uploaded file on the client's system without a period,
for
example, txt not .txt

clientFileName
 Filename, without an extension, of the uploaded file on the client's
system


contentSubType
 MIME content subtype of the saved file

contentType
 MIME content type of the saved file

dateLastAccessed
 Date and time the uploaded file was last accessed

fileExisted
 Indicates (Yes or No) whether or not the file already existed with the
same
path

fileSize
 Size of the uploaded file

fileWasAppended
 Indicates (Yes or No) whether ColdFusion appends the uploaded file to
an
existing file

fileWasOverwritten
 Indicates (Yes or No) whether ColdFusion overwrites a file

fileWasRenamed
 Indicates (Yes or No) whether the uploaded file is renamed to avoid a
name
conflict

fileWasSaved
 Indicates (Yes or No) whether Cold Fusion saves a file

oldFileSize
 Size of a file that was overwritten in the file upload operation

serverDirectory
 Directory of the file saved on the server

serverFile
 Filename of the file saved on the server

serverFileExt
 Extension of the uploaded file on the server, without a period

serverFileName
 Filename, without an extension, of the uploaded file on the server

timeCreated
 Time the uploaded file was created

timeLastModified
 Date and time of the last modification to the uploaded file

(I copied this straight from the docs, which explains the slightly funky
formatting.) You'll be interested in File.ContentType and
File.ContentSubType.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
------------------------------------------------------------------------------
To unsubscribe, send a message to [EMAIL PROTECTED] with 
'unsubscribe' in the body or visit the list page at www.houseoffusion.com

Reply via email to