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:
Forcing price recalculation in shopping cart (1998)
Quickie question on the email templates (1997)
[WebDNA] Sorry WebDNA server not running /Template ERROR/ Slow (2019)
WebCat2 Append problem (B14Macacgi) (1997)
No Subject (1998)
Questions To Answer (1997)
Moving a record from one dataabse to another. (2000)
Flash (2000)
Bug Report, maybe (1997)
WC Database Format (1997)
Help name our technology! (1997)
Universal root for WC errors? (1997)
[foundItems] context problem (2000)
Protect Tage and Groups (1998)
b12 cannot limit records returned and more. (1997)
set header in DB (no cart) (2003)
Formating found categories (1997)
[WebDNA] Using WebDNA with MAMP (2010)
WebCatalog can't find database (1997)
suffix mapping for NT? (1997)