Yes, any attempt to access the file specified in the <input type=file> field is forbidden for security reasons. All the browser does and can do is submit the data in binary format to the action page of the form. In order to check the file size on the client side it would take some type of complex applet, so basically I would consider it not possible and just check on the server side.
Daniel Elmore -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Ken Ferguson Sent: Friday, January 21, 2005 3:24 PM To: [email protected] Subject: RE: image manipulation Well, as far as I know you have to actually upload the image before you can tell what size it is. So I have a little module that allows them to pick their file and upload it. I store it in a temp dir and run my checks on it, like in the email I just sent out with the code. If all is good, I move the image to the final location and the upload bit is done. Does that make any sense to you? -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kevin Fricke Sent: Friday, January 21, 2005 10:10 AM To: [email protected] Subject: RE: image manipulation Ken: Thank is exactly what I am trying to do. What do you use to determine the size of the image that the client is trying to upload? Thanks!! Kevin -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Ken Ferguson Sent: Friday, January 21, 2005 8:33 AM To: [email protected] Subject: RE: image manipulation I don't know what Kevin is trying to do exactly, but there could be many reasons -- "I'm sorry, you can't upload images greater than 200*200" or "Your image is 50*50 and may appear distorted when the site displays it at the 300*300 default setting" ... You can use this information for any number of purposes. I do something similar in a PHP app that I have so people don't upload logos that are bigger in dimension than I want to show. But I still allow them to upload images of custom width and height as long as they don't exceed my maximums... Also, I have images of products that could be 300*300. They could be 280*280, or they could be 300* 225. If I want to show those images at something like 90 pixels wide. I need to know the width and height so I can manipulate them without distorting the image if it isn't square. --Ferg -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dan Blackman Sent: Friday, January 21, 2005 8:11 AM To: [email protected] Subject: RE: image manipulation The curious question here is "Why would you want to find the height and width of a client side object?" Curious!? Dan -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Adrian J. Moreno Sent: Thursday, January 20, 2005 11:30 PM To: [email protected] Subject: Re: image manipulation Found via Google: http://www.sitepoint.com/blog-post-view.php?id=168133 Quick and Dirty Way to get Image Dimensions by David Medlock However I can't see the need to invoke java.awt.Image as he has, so I removed the call. I also shoved everything into <cfscript>. -------------------- <code> -------------------- <cfscript> tk = CreateObject("java", "java.awt.Toolkit"); // "myImage" has to have the full physical path and file name. myImage = "C:\fi_logo.gif"; img = tk.getDefaultToolkit().getImage(myImage); width = img.getWidth(); height = img.getHeight(); </cfscript> <cfoutput> W: #variables.width# <br /> H: #variables.height# </cfoutput> -------------------- </code> -------------------- Edit: Daniel's post showed up just before I hit submit. Tested on my local Win2k desktop (CFMX on JBoss via cygwin), but this code should run anywhere java runs. Booyah! -- Adrian Kevin Fricke wrote: > Yes but I am trying to find out if there is a way for Coldfusion to > determine the size of the image....WxH? > > Any ideas? > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Thursday, January 20, 2005 1:15 PM > To: [EMAIL PROTECTED] > Subject: Re: image manipulation > > > Doesn't photoshop give you this info when you check on Image size? > ---------------------------------------------------------- To post, send email to [email protected] To unsubscribe: http://www.dfwcfug.org/form_MemberUnsubscribe.cfm To subscribe: http://www.dfwcfug.org/form_MemberRegistration.cfm ---------------------------------------------------------- To post, send email to [email protected] To unsubscribe: http://www.dfwcfug.org/form_MemberUnsubscribe.cfm To subscribe: http://www.dfwcfug.org/form_MemberRegistration.cfm ---------------------------------------------------------- To post, send email to [email protected] To unsubscribe: http://www.dfwcfug.org/form_MemberUnsubscribe.cfm To subscribe: http://www.dfwcfug.org/form_MemberRegistration.cfm ---------------------------------------------------------- To post, send email to [email protected] To unsubscribe: http://www.dfwcfug.org/form_MemberUnsubscribe.cfm To subscribe: http://www.dfwcfug.org/form_MemberRegistration.cfm ---------------------------------------------------------- To post, send email to [email protected] To unsubscribe: http://www.dfwcfug.org/form_MemberUnsubscribe.cfm To subscribe: http://www.dfwcfug.org/form_MemberRegistration.cfm
<<attachment: winmail.dat>>
