ftping and filetype property

Rob Cozens rcozens at pon.net
Tue Sep 16 09:59:01 EDT 2003


>has anyone created a master list of file-types in a Rev script and 
>parsed what their 8-character creator/type strings are? 
>
>Eg.
>
>if extension = "jpg" then set the filetype to "prvwjpeg"
>if extension = "ppt" then set the filetype to .....
>if extension = "doc" then set the filetype to .....
>if extension = "mov" then set the filetype to .....

Hi Rob,

If you're uploading files for downloads via other than your own app, 
this won't work; however if the files are always downloaded via your 
app, you can compress the files & append the file type in a header or 
footer, then decompress the download, read the header/footer, and 
reset the file type.  SDB Utilities uses this approach.

If you go the scripted route, use switch logic instead of if logic:

	switch extension
	case "jpg"
		set the filetype to "prvwjpeg"
	break
	case "ppt"
		set the filetype to...
	break
	case "doc"
		set the filetype to...
	break
	case "mov"
		set the filetype to...
	break
	default
		answer "Unsupported file type"
	end switch
-- 

Rob Cozens
CCW, Serendipity Software Company
http://www.oenolog.net/who.htm

"And I, which was two fooles, do so grow three;
Who are a little wise, the best fooles bee."

from "The Triple Foole" by John Donne (1572-1631)



More information about the use-livecode mailing list