Re: Add to a filename in multifile upload
This WebDNA talk-list message is from 2002
It keeps the original formatting.
numero = 42310
interpreted = N
texte = on 8/5/02 9:38 PM, Lester Emo at lester@klinternet.com so noted...> I have people upload photos files for ad listings and I'm trying to> identify them after uploading.I *thought* that code looked familiar -- and the comment about Windows' pathnames clinched it. ; )That code was used in a situation where the files were being uploaded in acontrolled environment and the filename could be used as submitted. Ifaccess is more open, you're going to want to check file type and setfilename yourself.This is something that determines the file type based upon the submittedMIME type. The name is entered in another field on the upload form([picText.n]) and has spaces removed, is trimmed for size, and a CYA randomnumber added. In your case, you could use something like the name of thelisting for the name, and just add an incremental number to the end.It supports a variety of file types, you could limit it to GIF and JPEG (orwhatever you're using).At the end, [ca_picError] will equal T if any errors were encountered,[ca_picError.n] will be the error message for that pic (here, just forunsupported type) and [ca_pic.1] through [ca_pic.n] will be the name createdfor the uploaded files.[formvariables][showif [url][name][/url]^%22theFile][if [url][value][/url]!][then][text]ca_fileType=[middle startafter=Content-Type: ][name][/middle][/text][if ([ca_fileType]^/gif)][then][text]ca_fileExt=gif[/text][/then][else][if ([ca_fileType]^/jpeg)][then][text]ca_fileExt=jpeg[/text][/then][else][if ([ca_fileType]^/msword)][then][text]ca_fileExt=doc[/text][/then][else][if ([ca_fileType]^/plain)|([ca_fileType]^/x-usenet-faq)][then][text]ca_fileExt=txt[/text][/then][else][if ([ca_fileType]^/rtf)|([ca_fileType]^/x-rtf)|([ca_fileType]^/richtext)][then][text]ca_fileExt=rtf[/text][/then][else][if ([ca_fileType]^/mspowerpoint)|([ca_fileType]^/powerpoint)|([ca_fileType]^/vnd.ms-powerpoint)|([ca_fileType]^/x-mspowerpoint)][then][text]ca_fileExt=ppt[/text][/then][else][if ([ca_fileType]^/pdf)][then][text]ca_fileExt=pdf[/text][/then][else][if ([ca_fileType]^/x-compressed)|([ca_fileType]^/x-zip-compressed)|([ca_fileType]^/zip)|([ca_fileType]^/x-zip)][then][text]ca_fileExt=zip[/text][/then][else][if ([ca_fileType]^/x-sit)|([ca_fileType]^/x-stuffit)][then][text]ca_fileExt=sit[/text][/then][else][text multi=T]ca_picError=T&ca_localErr=T&ca_picError.[index]=Uploaded fileis not a supported type[/text][/else][/if][/else][/if][/else][/if][/else][/if][/else][/if][/else][/if][/else][/if][/else][/if][/else][/if][showif [url][value][/url]!][showif [ca_localErr]!T][math show=f]ca_picTotal=1[/math][text]ca_pic.[index]=[getchars start=1&end=20][lowercase][grepsearch=[^a-zA-Z0-9]&replace=][text]picText.[index][/text][/grep][/lowercase][/getchars][getcharsstart=1&end=4][random][random][random][random][/getchars].[ca_fileExt][/text][writefile file=[text]ca_pic.[index][/text]&secure=F][value][/writefile][/showif][/showif][/then][/if][/showif][/formvariables]Rob MarquardtDesigner/Resident WireheadToast Design800 Washington Avenue NorthMinneapolis MN 55401612.330.9863 v612.321.9424 fwww.toastdesign.com-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list
.To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://search.smithmicro.com/
Associated Messages, from the most recent to the oldest:
on 8/5/02 9:38 PM, Lester Emo at lester@klinternet.com so noted...> I have people upload photos files for ad listings and I'm trying to> identify them after uploading.I *thought* that code looked familiar -- and the comment about Windows' pathnames clinched it. ; )That code was used in a situation where the files were being uploaded in acontrolled environment and the filename could be used as submitted. Ifaccess is more open, you're going to want to check file type and setfilename yourself.This is something that determines the file type based upon the submittedMIME type. The name is entered in another field on the upload form([picText.n]) and has spaces removed, is trimmed for size, and a CYA randomnumber added. In your case, you could use something like the name of thelisting for the name, and just add an incremental number to the end.It supports a variety of file types, you could limit it to GIF and JPEG (orwhatever you're using).At the end, [ca_picError] will equal T if any errors were encountered,[ca_picError.n] will be the error message for that pic (here, just forunsupported type) and [ca_pic.1] through [ca_pic.n] will be the name createdfor the uploaded files.[formvariables][showif [url][name][/url]^%22theFile][if [url][value][/url]!][then][text]ca_fileType=[middle startafter=Content-Type: ][name][/middle][/text][if ([ca_fileType]^/gif)][then][text]ca_fileExt=gif[/text][/then][else][if ([ca_fileType]^/jpeg)][then][text]ca_fileExt=jpeg[/text][/then][else][if ([ca_fileType]^/msword)][then][text]ca_fileExt=doc[/text][/then][else][if ([ca_fileType]^/plain)|([ca_fileType]^/x-usenet-faq)][then][text]ca_fileExt=txt[/text][/then][else][if ([ca_fileType]^/rtf)|([ca_fileType]^/x-rtf)|([ca_fileType]^/richtext)][then][text]ca_fileExt=rtf[/text][/then][else][if ([ca_fileType]^/mspowerpoint)|([ca_fileType]^/powerpoint)|([ca_fileType]^/vnd.ms-powerpoint)|([ca_fileType]^/x-mspowerpoint)][then][text]ca_fileExt=ppt[/text][/then][else][if ([ca_fileType]^/pdf)][then][text]ca_fileExt=pdf[/text][/then][else][if ([ca_fileType]^/x-compressed)|([ca_fileType]^/x-zip-compressed)|([ca_fileType]^/zip)|([ca_fileType]^/x-zip)][then][text]ca_fileExt=zip[/text][/then][else][if ([ca_fileType]^/x-sit)|([ca_fileType]^/x-stuffit)][then][text]ca_fileExt=sit[/text][/then][else][text multi=T]ca_picError=T&ca_localErr=T&ca_picError.[index]=Uploaded fileis not a supported type[/text][/else][/if][/else][/if][/else][/if][/else][/if][/else][/if][/else][/if][/else][/if][/else][/if][/else][/if][showif [url][value][/url]!][showif [ca_localErr]!T][math show=f]ca_picTotal=1[/math][text]ca_pic.[index]=[getchars start=1&end=20][lowercase][grepsearch=[^a-zA-Z0-9]&replace=][text]picText.[index][/text][/grep][/lowercase][/getchars][getcharsstart=1&end=4][random][random][random][random][/getchars].[ca_fileExt][/text][writefile file=[text]ca_pic.[index][/text]&secure=F][value][/writefile][/showif][/showif][/then][/if][/showif][/formvariables]Rob MarquardtDesigner/Resident WireheadToast Design800 Washington Avenue NorthMinneapolis MN 55401612.330.9863 v612.321.9424 fwww.toastdesign.com-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list .To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://search.smithmicro.com/
Rob Marquardt
DOWNLOAD WEBDNA NOW!
Top Articles:
Talk List
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...
Related Readings:
[OT] (waaaay OT) (2004)
WebCatalog 4.0 Users that want to talk to the Media.... (2000)
[OT] Who's got a cool link (2002)
WebCat2b15MacPlugin - [protect] (1997)
WebCat2b15MacPlugin - [protect] (1997)
Plugin or CGI or both (1997)
OT: Urgent help with Windows and Javascript (2003)
using WebCat for Associate Programs? (1998)
OK, here goes... (1997)
email preferences on NT (1997)
flushdatabases (2000)
Reindexing a db with duplicate numbers... (1999)
Just a thought (1998)
WebCat2: Formulas.db question (1997)
Categories and Sub-categories (2003)
Hiding HTML and page breaks (1997)
Webcat & SIMS (1998)
Separate SSL Server (1997)
Suffix Mapping (1997)
WebCat2 Append problem (B14Macacgi) (1997)