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:
Browser (agent) stats... (2004)
[addlineitems] (1997)
WebCatalog can't find database (1997)
Creating main- and sub-category search (1997)
Re[2]: Error 551 (2000)
View order not right (1997)
hideif/showif causes error if wrapped around searches (2003)
Wanted: More Math Functions (or, Can You Solve This?) (1997)
[WebDNA] WebDNA & Google Chrome Browser (2012)
PCS Frames (1997)
oops private message leaked into talk list (1997)
Re:Virtual hosting and webcatNT (1997)
deadlock (2000)
Date Sorting (1997)
WebCat2.0 [format thousands .0f] no go (1997)
Renaming textA (1998)
Thanks ! (1997)
Calendar Solutions (1998)
RE: Answer: WebDelivery downloads alias, not original ? (1997)
WebCatalog dying in NT (1998)