Re: Image size & weight limit on upload

This WebDNA talk-list message is from

2002


It keeps the original formatting.
numero = 41234
interpreted = N
texte = > How do I limit the width/height and size of a file when someone is > uploading it to my site?You can only do this after the file is uploaded; you have no way to determine these values before the file is uploaded. Although, you can run a [deletefile] context if they are outside your parameters.Since I do not know where you are at in this process, I am going to start at the very beginning. Feel free to ignore any steps you have already completed:------------------------------ formpage.tpl------------------------------
------------------------------writefile.tpl------------------------------ [text]image=[/text][formvariables] [showif [url][name][/url]^[url]image[/url]] [hideif [image]=] [writefile file=../images/filename.jpg][value][/writefile] [/hideif] [/showif] [/formvariables][math show=F]errors=0[/math][fileinfo file=../images/filename.jpg] [showif [exists]=F] [math show=F]errors=[errors]+1[/math] [/showif] [showif [size]>52223] [math show=F]errors=[errors]+1[/math] [/showif] [showif [imagewidth]>350] [math show=F]errors=[errors]+1[/math] [/showif] [showif [imageheight]>350] [math show=F]errors=[errors]+1[/math] [/showif] [/fileinfo][showif [errors]=0][include file=correctpage.txt][/showif] [showif [errors]>0][include file=errorpage.txt][/showif]------------------------------end of code------------------------------Since there will already be a delay when posting the original form due to the time it takes for the image file to upload, I find that checking the size information in the same template produces no noticible additional delay (it would probably be only milliseconds anyway). Also, if you are interested, I have some code for detecting whether an image file is a Jpeg or Gif file which is not based on file extension.Dennis ------------------------------------------------------------- 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:

    
  1. Re: Image size & weight limit on upload (Kenneth Grome 2002)
  2. Re: Image size & weight limit on upload (Dennis J. Bonsall, Jr. 2002)
  3. Re: Image size & weight limit on upload (Dennis J. Bonsall, Jr. 2002)
  4. Re: Image size & weight limit on upload (Alisha Outridge 2002)
  5. Image size & weight limit on upload (Alisha Outridge 2002)
  6. Addition: Image size tags (Jason Tyler 2000)
  7. Image size tags (Jason Tyler 2000)
> How do I limit the width/height and size of a file when someone is > uploading it to my site?You can only do this after the file is uploaded; you have no way to determine these values before the file is uploaded. Although, you can run a [deletefile] context if they are outside your parameters.Since I do not know where you are at in this process, I am going to start at the very beginning. Feel free to ignore any steps you have already completed:------------------------------ formpage.tpl------------------------------
------------------------------writefile.tpl------------------------------ [text]image=[/text][formvariables] [showif [url][name][/url]^[url]image[/url]] [hideif [image]=] [writefile file=../images/filename.jpg][value][/writefile] [/hideif] [/showif] [/formvariables][math show=F]errors=0[/math][fileinfo file=../images/filename.jpg] [showif [exists]=F] [math show=F]errors=[errors]+1[/math] [/showif] [showif [size]>52223] [math show=F]errors=[errors]+1[/math] [/showif] [showif [imagewidth]>350] [math show=F]errors=[errors]+1[/math] [/showif] [showif [imageheight]>350] [math show=F]errors=[errors]+1[/math] [/showif] [/fileinfo][showif [errors]=0][include file=correctpage.txt][/showif] [showif [errors]>0][include file=errorpage.txt][/showif]------------------------------end of code------------------------------Since there will already be a delay when posting the original form due to the time it takes for the image file to upload, I find that checking the size information in the same template produces no noticible additional delay (it would probably be only milliseconds anyway). Also, if you are interested, I have some code for detecting whether an image file is a Jpeg or Gif file which is not based on file extension.Dennis ------------------------------------------------------------- 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/ Dennis J. Bonsall, Jr.

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:

sort problems....bug or brain fart? (1997) Trouble with formula.db (1997) Re:WebCatalog/WebMerchant III (1998) addlineitem is not saving a variable. (2004) spreadsheet interface (1998) autocommit problem (1998) [showif]/[hideif] question (1997) Suffix Mapping (1998) WebCat2b15MacPlugin - [protect] (1997) weird user / authenticate happenings (2003) WebCat2b12 - nesting [tags] (1997) Linebreaks and [writefile] (2003) Quickie question on the email templates (1997) I try hard to think positively (1998) Major Security Hole IIS NT (1998) Recursion & WebDNA (1999) WebCat2b15MacPlugin - showing [math] (1997) Poll Please (2002) Searching for a Blank Field (2000) wierd [cart] action! (1997)