Re: windows file upload = weirdness

This WebDNA talk-list message is from

2004


It keeps the original formatting.
numero = 57600
interpreted = N
texte = I think an example is in order here... Say the user uploads a file and the full-path filename comes through as "C:Documents/jim&bob.jpg" Using your code sample (without the URLs): [Text]fullfilename=[Middle StartAfter=filename="&endbefore="][name][/Middle][/Text] [listwords words=[fullfilename]&delimiters=:/\] [text]rawfilename=[word][/text] [/listwords] results in the variable [rawfilename] having a value of "jim". The reason is that the WebDNA parser encounters the ampersand between "jim" and "bob" and truncates the words parameter there, then ignores what it thinks is a parameter named "bob.jpg" (which follows the ampersand). If you add URLs to the words parameter: [listwords words=[url][fullfilename][/url]&delimiters=:/\] then the resulting [rawfilename] is the correct value "jim&bob.jpg", and your later code can strip the ampersand if desired. Note that the resulting value does not have the url'ed "%26" for the ampersand. WebDNA's parser ALWAYS does an implied [unurl] on any named parameter (one specified as "param=value") before processing its value; the [url] context is there to permit the use of characters such as ampersands and equal signs that would otherwise foul up the parameters. - brian On Apr 29, 2004, at 6:29 AM, Terry Wilson wrote: > You're right; I should have clarified that I took them out because I > have code later that strips illegals out of filenames; by URLing them, > they wouldn't get stripped, but stay in as %20 and such. > > As it happens, this wasn't the cause of her problem. But it did > resolve the one issue. > >> Taking out the URLs around [fullfilename] will cause problems if by >> chance the user has an & or = in their path. Out of habit I always >> URL the delimiters as well, because I sometimes use & and = as >> delimiters. It won't hurt anything to leave them in. >> -- Brian Fries, BrainScan Software -- http://www.brainscansoftware.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://webdna.smithmicro.com/ Associated Messages, from the most recent to the oldest:

    
  1. Re: windows file upload = weirdness ( Brian Fries 2004)
  2. Re: windows file upload = weirdness ( Terry Wilson 2004)
  3. Re: windows file upload = weirdness ( Brian Fries 2004)
  4. Re: windows file upload = weirdness ( Terry Wilson 2004)
  5. Re: windows file upload = weirdness ( Terry Wilson 2004)
  6. Re: windows file upload = weirdness ( Brian Fries 2004)
  7. windows file upload = weirdness ( Terry Wilson 2004)
I think an example is in order here... Say the user uploads a file and the full-path filename comes through as "C:Documents/jim&bob.jpg" Using your code sample (without the URLs): [text]fullfilename=[Middle StartAfter=filename="&endbefore="][name][/Middle][/Text] [listwords words=[fullfilename]&delimiters=:/\] [text]rawfilename=[word][/text] [/listwords] results in the variable [rawfilename] having a value of "jim". The reason is that the WebDNA parser encounters the ampersand between "jim" and "bob" and truncates the words parameter there, then ignores what it thinks is a parameter named "bob.jpg" (which follows the ampersand). If you add URLs to the words parameter: [listwords words=[url][fullfilename][/url]&delimiters=:/\] then the resulting [rawfilename] is the correct value "jim&bob.jpg", and your later code can strip the ampersand if desired. Note that the resulting value does not have the url'ed "%26" for the ampersand. WebDNA's parser ALWAYS does an implied [unurl] on any named parameter (one specified as "param=value") before processing its value; the [url] context is there to permit the use of characters such as ampersands and equal signs that would otherwise foul up the parameters. - brian On Apr 29, 2004, at 6:29 AM, Terry Wilson wrote: > You're right; I should have clarified that I took them out because I > have code later that strips illegals out of filenames; by URLing them, > they wouldn't get stripped, but stay in as %20 and such. > > As it happens, this wasn't the cause of her problem. But it did > resolve the one issue. > >> Taking out the URLs around [fullfilename] will cause problems if by >> chance the user has an & or = in their path. Out of habit I always >> URL the delimiters as well, because I sometimes use & and = as >> delimiters. It won't hurt anything to leave them in. >> -- Brian Fries, BrainScan Software -- http://www.brainscansoftware.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://webdna.smithmicro.com/ Brian Fries

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:

[Webcat 2]Next (1997) date range (1998) [WebDNA] preventing hackers from posting their own (altered) version of my form? (2009) Online reference (1997) Dreamweave MX/WebDNA (2003) Copyright that puppy (1998) PSC recommends what date format yr 2000??? (1997) database with 10,000+ web pages stored in it? (2000) Providing hard copy of database to client (1997) Execute Applescript (1997) encrypt (2000) WebCat2b15MacPlugin - [protect] (1997) [cart] generation (1998) Ship Cost Calculated via Subtotal (1998) RE: Missing contexts on NT (1997) Purchased cart being overwritten (1997) Search in 2 or more catalogs (1997) [showif]/[hideif] question (1997) Pithy questions on webcommerce & siteedit (1997) Webmerch tags? (1998)