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:
Re:Help name our technology! (1997)
Writefile problem (1999)
Webcat2, WebCommerce, Mod 10 etc. (1997)
[math show=f]nuCheck1=[check1]=1[/math] = proper syntax?? (2000)
Loop into field (1998)
New Server? (2006)
Database of Tax Rates? (1997)
LetterRip and WebCat & more (1998)
Multiple prices (1997)
[WebDNA] Updating WebDNA 8.x to WebDNA 8.2 (2016)
Beta Documentation (1997)
Bug or syntax error on my part? (1997)
WebCat2 several catalogs? (1997)
Has anyone integrated ZipBurst with WebCat? (2000)
Banner Ad example (Typhoon) and WebCatalog (1997)
Looking for a Manual (1997)
WebCat2 Append problem (B14Macacgi) (1997)
email problem (1998)
credit card authorization question (1997)
Only charge card when product shipped ? (1997)