FYI - If you don't give the initial image a size (no height/width attributes) and just use a 1x1 px gif then the image will auto-resize when previewing.
Joshua Miller Head Programmer / IT Manager Garrison Enterprises Inc. www.garrisonenterprises.net [EMAIL PROTECTED] (704) 569-9044 ext. 254 ************************************************************************ ************* Any views expressed in this message are those of the individual sender, except where the sender states them to be the views of Garrison Enterprises Inc. This e-mail is intended only for the individual or entity to which it is addressed and contains information that is private and confidential. If you are not the intended recipient you are hereby notified that any dissemination, distribution or copying is strictly prohibited. If you have received this e-mail in error please delete it immediately and advise us by return e-mail to [EMAIL PROTECTED] ************************************************************************ ************* -----Original Message----- From: jon hall [mailto:[EMAIL PROTECTED] Sent: Thursday, March 06, 2003 3:05 PM To: CF-Talk Subject: Re: image upload via cffile: preview prior to submit? Just did this yesterday. <script type="text/javascript"> function showImage(img) { var imgObj = document.images['header']; imgObj.src = 'file:///' + img; } </script> <input type="File" name="header_image" id="header_image" size="45" onchange="showImage(this.value)"> <img src="bg_head.gif" name="header" id="header"> However this doesn't work completetly in NS4 or at all in Mozilla because I was being lazy and the site was IE only anyway. NS4 because it doesn't support changing an image _size_ via JS (src it will change), you would have to use doc.write to write the img tag to a span/div/ilayer/layer in NS4. It should work in Mozilla, but it wasn't for me yesterday...because Mozilla has more bugs than MX even lol. Specifically though, the onchange event wasn't firing in Moz. -- jon mailto:[EMAIL PROTECTED] Thursday, March 6, 2003, 2:25:40 PM, you wrote: JZ> Hi List! JZ> I have templates which allow a user to upload an image. I would like JZ> to be able to let the user preview the image before they commit the JZ> form: They browse to locate the image file, and after they've said JZ> ok to a file, the file path info is populated in the "upfile" field JZ> in the form (below). I was thinking there should be a JS way to JZ> display that image right after the "upfile" field is populated and JZ> before the form is committed. JZ> I didn't *want* to use another page to do it (select image, submit JZ> form, use next page to add additional descriptors) but being a js JZ> novice... JZ> Ideas? Ridicule? 8-P JZ> The form: JZ> (using cf5) JZ> <cfform action="image_process.cfm" method="post" JZ> enctype="multipart/form-data"> <strong><p align="center">click JZ> browse to enter the filename!<br> <cfoutput> JZ> <input name="upfile" type="File" size="50" required="yes"> JZ> <input type="Hidden" name="mountnumber" value=#URL.mountnumber#> JZ> <br><br> JZ> caption: <input name="caption" type="text" size="50" required="no" JZ> VALUE="enter caption here" onfocus="javascript:this.value='';"> JZ> --snip-- JZ> joe JZ> -- JZ> Joe Zanter, Materials Lab, Woodward Aircraft Engine Systems JZ> 5001 North 2nd Street, Rockford IL 61125 JZ> ph 815-639-6312, fx 815-639-5104 JZ> mailto:[EMAIL PROTECTED] JZ> Visualize Whirled Peas! JZ> *** JZ> The information in this e-mail is confidential and intended solely JZ> for the individual or entity to whom it is addressed. If you have JZ> received this e-mail in error please notify the sender by return JZ> e-mail, delete this e-mail, and refrain from any disclosure or JZ> action based on the information. JZ> **** JZ> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4