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:

Invoice in another window (1998) ConvertWords (2001) Location of Browser Info.txt file (1997) Search returns all, not 20 (1997) shared_POP and archiving your own mailing list (2003) [click][/click] (1999) Syntax of a URL for including ?cart=[cart] and #something? (1998) Running 2 two WebCatalog.acgi's (1996) Smith Micro - no competition (2000) .html processing? (1998) [REPLACE] inside [FOUNDITEMS] (1998) Feature req. (2002) boldwords (2001) Opinion: [input] should be called [output] ... (1997) unable to launch acgi in WebCat (1997) File Upload (1997) [GROUPS] followup (1997) Errata: WCS Newbie question (1997) Execute Applescript (1997) DON'T use old cart file! (1997)