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 thesevalues before the file is uploaded. Although, you can run a [deletefile] contextif they are outside your parameters.Since I do not know where you are at in this process, I am going to start at thevery 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 timeit takes for the image file to upload, I find that checking the size information inthe same template produces no noticible additional delay (it would probably be onlymilliseconds anyway). Also, if you are interested, I have some code for detectingwhether 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:
> 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 thesevalues before the file is uploaded. Although, you can run a [deletefile] contextif they are outside your parameters.Since I do not know where you are at in this process, I am going to start at thevery 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 timeit takes for the image file to upload, I find that checking the size information inthe same template produces no noticible additional delay (it would probably be onlymilliseconds anyway). Also, if you are interested, I have some code for detectingwhether 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:
WebCatalog/Mac 2.1b2 - PIXO (1997)
TCP Connect (1999)
NY taxRates.db? (1997)
process SSI (1998)
test (2000)
webcat- multiple selection in input field (1997)
Restricting templates from causing havoc (2000)
RE: extended ASCII with middle command (1999)
New commands in Final candidate (1997)
verify online (1997)
[input] [/input] (1997)
Banners (1997)
[format xs] freeze (1997)
[/application] error? (1997)
Multiple cart additions (1997)
Proper file locations (1997)
signup bots (2006)
Need help with emailer- 2 issues (1997)
Final Receipt (1999)
WebDNA and Virtual Servers (2003)