Question

Coldfusion - Upload an image, make thumb, write both to DB, show thumb in update employee form page

Asked by: MPEC_ADHD

I have created an app in Coldfusion to where company employees can put their bios on the company website.


It starts with staff index.cfm (see screenshot) If an employee's image is missing they click on upload beside the missing image. This takes them to the upload page. They browse and upload the image and get sent back to staffindex.cfm to supposedly see the new image show up under the correct employee.

I need to write the image and thumb to the database and save the images in their respective folders: staffimages/thumbs
and staffimages/medium, (another directory on the same level) then show staffindex.cfm with the newly uploaded image showing beside the correct employee

<cfset thisDir = expandPath(".")> 
<!--- Determine whether the form is uploaded with the image. ---> 
<cfif structKeyExists(form,"uploadedimage") and len(trim(form.uploadedimage))> 
    <!--- Use the cffile tag to upload the image file. ---> 
    <cffile action="upload" 
    	fileField="uploadedimage" 
        destination="#thisDir#" 
        result="fileUpload" 
        nameconflict="overwrite"> 
    <!--- Determine whether the image file is saved. ---> 
    <cfif fileUpload.fileWasSaved> 
    <!--- Determine whether the saved file is a valid image file. ---> 
        <cfif IsImageFile("#fileUpload.serverfile#")> 
    <!--- Read the image file into a variable called myImage. ---> 
            <cfimage action="read" source="#fileUpload.serverfile#" name="myuploadedimage"> 
            <!--- Determine whether the image file exceeds the size limits. ---> 
            <cfif ImageGetHeight(myuploadedimage) gt 1600 or ImageGetWidth(myuploadedimage) gt 1600> 
                <!--- If the file is too large, delete it from the server. ---> 
                <cffile action="delete" 
                    file="#fileUpload.serverDirectory#/#fileUpload.serverFile#"> 
                <cfoutput> 
                <p> 
                The image you uploaded was too large. It must be less than 800 pixels wide 
                    and 800 pixels high. Your image was #imageGetWidth(myuploadedimage)# pixels wide 
                    and #imageGetHeight(myuploadedimage)# pixels high.                </p> 
                </cfoutput> 
                <!--- If the image is valid and does not exceed the size limits, 
                    create a thumbnail image from the source file that is 75-pixels 
                    square, while maintaining the aspect ratio of the source image.  
                    Use the bilinear interpolation method to improve performance. 
                    ---> 
            <cfelse> 
 
    <cfset ImageScaleToFit(myuploadedimage,75,75,"bilinear")> 
                <!--- Specify the new filename as the source filename with 
                    "_thumbnail" appended to it. ---> 
                <cfset newImageName = fileUpload.serverDirectory & "/" & 
                    fileUpload.serverFilename & "_thumbnail." & 
                    fileUpload.serverFileExt> 
                <!--- Save the thumbnail image to a file with the new filename. ---> 
                <cfimage source="#myuploadedImage#" action="write" 
                    destination="#newImageName#" overwrite="yes"> 
                <cfoutput> 
                <p> 
                Thank you for uploading the image. We have created a thumbnail for 
                    your picture.                </p> 
                <p> 
                <!--- Display the thumbnail image. --->
                <img src="#getFileFromPath(newImageName)#" /></p> 
              </cfoutput>     
            </cfif> 
        <!--- If it is not a valid image file, delete it from the server. ---> 
        <cfelse> 
            <cffile action="delete" 
                file="#fileUpload.serverDirectory#/#fileUpload.serverFile#"> 
            <cfoutput> 
            <p> 
            The file you uploaded, #fileUpload.clientFile#, was not a valid image.            </p> 
            </cfoutput> 
        </cfif> 
    </cfif> 
</cfif>
                                  
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:

Select allOpen in new window

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-08-08 at 12:51:09ID24637349
Tags

Coldfusion

,

Upload image

,

make thumb

,

write thumb and image to DB

,

show thumb in update employee form page

Topics

Cold Fusion Markup Language

,

ColdFusion Studio

Participating Experts
1
Points
500
Comments
20

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. TTreeView thumb size
    How can I get height of thumb on the vertical scroll bar on the TTreeView?
  2. Thumb drive
    I have a thumb drive, I copied some files from drive C into it but when I plug it to a laptop it's empty. Same thing happened before but with a hard disk, files copied from other computer disappeared when I bring my hard disk back to my computer. Does anybody know why?
  3. Is "THUMBS" file a threat?
    message while copying picture files" "..THUMBS .. This file has extra info attached ...??? Located in C:\Windows\System32\THUMBS ( No extension) Anyone know what this is? Bob
  4. Thumbs ? What is that ?
    Hello, When I move files in my computer. I find ( Thumbs ) files. What is that ??

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: myselfrandhawaPosted on 2009-08-09 at 19:42:12ID: 25056865

Here you go

I have splitted the parts how you can do,

Ok first click on Upload and you will have this code to upload:


<cfform action="#cgi.SCRIPT_NAME#?#cgi.QUERY_STRING#" enctype="multipart/form-data" method="post">
                  <label>File:</label>
                  <input name="uploadfile" type="File" style="width:300px;">
<input name="upload" type="submit" class="submitbutton" value="Upload">
</cfform>
 
ok now we have the upload functionality:
 
here is the code
 
<cfif isDefined('form.upload')>
<cfset destnation = "#ExpandPath("pictures")#">
<cffile accept="image/*" action="upload" destination="#destnation#\" 
                filefield="uploadimage" nameconflict="overwrite">
              <cfset inpoint = "#cffile.ServerFile#">
              <cfimage action="resize" width="125" height="" source="#destnation#\#inpoint#" 
                destination="#destnation#\thumb_#inpoint#" overwrite="yes">
              <cfimage action="resize" width="#form.t2#" height="#form.t1#" source="#destnation\#inpoint#" 
                destination="#destnation\big_#inpoint#" overwrite="yes">
              <cfset form.cinpoint = "big_#inpoint#"> 
              <cfset form.thumbnail = "thumb_#inpoint#"> 
</cfif>
 
Use the form values in the last two lines in your insert starement to insert into database
 
Cheers
 
 
Let me i know if something skipped.
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:

Select allOpen in new window

 

by: MPEC_ADHDPosted on 2009-08-10 at 11:23:50ID: 25062516

Thank you.  But I would like to stick closely to the code that I am using.

Maybe I need to rephrase the question, getting the most pertinant answered first.

1.  Based on the code below:  where in my code snippet do I write the file destination to save first the main image, then the thumb?  

The folder for the main images: "images/staffimages/mainimages" , and for the thumbnails:  "images/staffimages/thumbs"

2. I need to update an existing employee record with the paths of both the thumb and the main image. the database is crownford, the table is employees, the fields that I would like to update  are bioimage, and biothumb  Where in the code do I right the paths to the database record

So nothing is missed, I am giving all the code relating to this question. Please let me know anyone needs anything else.

Thank you in advance

<!--- This is the index page where the app starts and ends. 
 
How it works:  
 
1. User starts on this page, then clicks on the "upload" link to upload an image for the employee.
2. User is taken to the upload.cfm page, which shows the specific employee name in variables.pageTitle. browses for the image, then clicks upload.
3. User is rediredted to action.cfm where the upload is verified that it exists, then resized. A thumbnail image is then created.
4.  Main image is saved to the "images/staffimages/mainimages/uploadedimage.jpg  the thumbnail image is saved to the "images/staffimages/thumbs/uploadedimage_thumb.jpg
5. File paths are then updated to the specific employee record in the database named crownford, table named employees, tablerows bioimage and biothumb, respectively. 
6. User is then redirected back to the staffindex.cfm where the newly uploaded image should now be showing. (the thumbnail image) --->
 
<cfinvoke 
 component="crownfordcf9.Components.Bios"
 method="getAllBios"
 returnvariable="qBios">
</cfinvoke>
 
 
 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<cfmodule template="../tags/headtag.cfm" pagetitle="Staff Index">
<link href="../staffBioStyles.css" rel="stylesheet" type="text/css" />
 
</head>
 
<body class="oneColElsCtrHdr">
<div id="container">
 
	<cfset variables.pageTitle="Main Template Page">
    <cfinclude template="includes/header.cfm">
 
  <div id="mainContent">
  <div class="mainContentContentWrapper">
  <cfif qBios.RecordCount IS 0>
    	<h4>No data was returned by this query.</h4>
    <cfelse>
    <table border="1">
      <tr>
        <th width="73" nowrap="nowrap" bgcolor="#FF99FF">Employee #</th>
        <th width="146" nowrap="nowrap" bgcolor="#FF99FF">First Name</th>
        <th width="145" nowrap="nowrap" bgcolor="#FF99FF">Last Name</th>
        <th>Image</th>
        <th>Upload</th>
        <th>Edit</th>
        <th>Delete</th>
        <th>View Bio</th>
      </tr>
      <cfoutput query="qBios">
		<cfif qBios.CurrentRow mod 2 IS 1>
        	<cfset bgcolor="white">
        <cfelse>
        	<cfset bgcolor="silver">
        </cfif>
        <tr bgcolor="#variables.bgcolor#">
          <td><span class="style1">#qBios.CurrentRow#</span></td>
          <td><span class="style1">#qBios.FirstName#</span></td>
          <td><span class="style1">#qBios.LastName#</span></td>
          <td><img src="#qBios.biothumb#" alt="" name="bioimage" id="bioimage" /></td>
          <td><a href="uploadimage.cfm?idemployees=#qBios.idemployees#">Upload</a></td>
          <td><a href="updatebio.cfm?idemployees=#qBios.idemployees#" class="style2">Edit</a></td>
          <td><a href="deletebio.cfm?idemployees=#qBios.idemployees#" class="style2">Delete</a></td>
          
          <td><a href="biodetail.cfm?idemployees=#qBios.idemployees#">View Bio</a></td>
        </tr>
      </cfoutput>
    </table>
    </cfif>
     
      <h4><a href="insertstaff.cfm">Insert New Staff Bio</a></h4>
    </div>  
    <!-- end #mainContent -->
   <!---  <cfdump var="#application#" label="Application Scope"> --->
  </div>
  <cfinclude template="../includes/footer.cfm">
  <!-- end #container -->
</div>
</body>
</html>
 
<!---//---------------------------------------------------------------------
 
 
 This is the page for uploading the image --->
 
<cfif IsDefined("form.firstname")>
	<cfinvoke 
         component="crownfordcf9.Components.BioDetail"
         method="updateBio">
	<cfinvokeargument name="formData" value="#form#"/>
</cfinvoke>
 
<cflocation url="staffindex.cfm" addtoken="no">
 
<cfelse>
<cfinvoke 
 component="crownfordcf9.Components.Bios"
 method="getBioByQueryID"
 returnvariable="qBio">
	<cfinvokeargument name="idemployees" value="#url.idemployees#"/>
</cfinvoke>
	
</cfif>
<cfinvoke 
 component="crownfordcf9.Components.Bios"
 method="getBioByID"
 returnvariable="employeeName"
 idemployees="#url.idemployees#">
</cfinvoke>
<cfinvoke
  component="crownfordcf9.Components.BioDetail"
  method="getQBioDetail"
  returnvariable="qBioDetail">
<!--- CFC Query --->
<cfinvokeargument name="idemployees" value="#url.idemployees#">
</cfinvoke>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<cfmodule template="../tags/headtag.cfm" pagetitle="Staff Index">
<cfparam name="attributes.pagetitle" default="Default Page Title">
<link href="../mockup3Styles.css" rel="stylesheet" type="text/css" />
<link href="../formStyles.css" rel="stylesheet" type="text/css" />
 
<cfmodule template="../tags/headtag.cfm" pagetitle="Staff Index">
 
<style type="text/css">
<!--
-->
</style>
 
 
<link href="../uploadstylessecondary.css" rel="stylesheet" type="text/css" />
</head>
 
 
<body class="oneColElsCtrHdr"
"onload="MM_preloadImages('../images/home_btn_f3.png','../images/home_btn_f2.png','../images/home_btn_f4.png','../images/inventory_btn_f3.png','../images/inventory_btn_f2.png','../images/inventory_btn_f4.png','../images/video_btn_f3.png','../images/video_btn_f2.png','../images/finince_btn_f3.png','../images/finince_btn_f2.png','../images/finince_btn_f4.png','../images/serviceparts_btn_f3.png','../images/serviceparts_btn_f2.png','../images/serviceparts_btn_f4.png','../images/specials_btn_f3.png','../images/specials_btn_f2.png','../images/specials_btn_f4.png','../images/departments_btn_f3.png','../images/departments_btn_f2.png','../images/departments_btn_f4.png','../images/logout_f3.png','../images/logout_f2.png','../images/logout_f4.png')">
<div id="container">
   <cfset variables.pageTitle="Upload Image for" & variables.employeeName & "?">
  <cfinclude template="includes/header.cfm">
  <div id="mainContentContentWrapper">
    <!--- This code creates a form with one field where the user enters the image file to upload. --->
    <fieldset id="imageuploadfieldset">
    <legend class="imageupload">Image Upload</legend>
    <cfform action="action.cfm" method="post" enctype="multipart/form-data">
      <div id="uploadwrapper"> 
        <h4>Please upload an image:</h4>
        <p><cfinput type="file" name="uploadedimage"></p>
       <p> <cfinput type="submit" value="Send Image" name="Submit"></p>
        <cfinput type="hidden" name="idemployees" value="#qBio.idemployees#">
      </div>
    
    </cfform>
    </fieldset>
  </div>
  <cfinclude template="includes/footer.cfm">
</div>
</body>
 
<!--- This is the action of the upload image page --->
 
<cfparam name="url.idemployees" default="1">
<cfif IsDefined("form.firstname")>
  <cfinvoke 
         component="crownfordcf9.Components.BioDetail"
         method="updateBio">
  <cfinvokeargument name="formData" value="#form#"/>
  </cfinvoke>
<cfinvoke 
 component="crownfordcf9.Components.Bios"
 method="getAllBios"
 returnvariable="qBios">
</cfinvoke>
 
  <cfelse>
  <cfinvoke 
 component="crownfordcf9.Components.Bios"
 method="getBioByQueryID"
 returnvariable="qBio">
  <cfinvokeargument name="idemployees" value="#url.idemployees#"/>
  </cfinvoke>
</cfif>
<cfinvoke 
 component="crownfordcf9.Components.Bios"
 method="getBioByID"
 returnvariable="employeeName"
 idemployees="#url.idemployees#"></cfinvoke>
<cfinvoke
  component="crownfordcf9.Components.BioDetail"
  method="getQBioDetail"
  returnvariable="qBioDetail">
<!--- CFC Query --->
<cfinvokeargument name="idemployees" value="#url.idemployees#">
</cfinvoke>
<cfset thisDir = expandPath(".")>
<!--- Determine whether the form is uploaded with the image. --->
<cfif structKeyExists(form,"uploadedimage") and len(trim(form.uploadedimage))>
  <!--- Use the cffile tag to upload the image file. --->
  <cffile action="upload" 
    	fileField="uploadedimage" 
        destination="#thisDir#" 
        result="fileUpload" 
        nameconflict="overwrite">
  <!--- Determine whether the image file is saved. --->
  <cfif fileUpload.fileWasSaved>
    <!--- Determine whether the saved file is a valid image file. --->
    <cfif IsImageFile("#fileUpload.serverfile#")>
      <!--- Read the image file into a variable called myImage. --->
      <cfimage action="read" source="#fileUpload.serverfile#" name="myuploadedimage">
      <!--- Determine whether the image file exceeds the size limits. --->
      <cfif ImageGetHeight(myuploadedimage) gt 1600 or ImageGetWidth(myuploadedimage) gt 1600>
        <!--- If the file is too large, delete it from the server. --->
        <cffile action="delete" 
                    file="#fileUpload.serverDirectory#/#fileUpload.serverFile#">
        <cfoutput>
          <p>The image you uploaded was too large. It must be less than 800 pixels wide 
            and 800 pixels high. Your image was#imageGetWidth(myuploadedimage)#pixels wide 
            and#imageGetHeight(myuploadedimage)#pixels high.</p>
        </cfoutput>
        <!--- If the image is valid and does not exceed the size limits, 
                    create a thumbnail image from the source file that is 75-pixels 
                    square, while maintaining the aspect ratio of the source image.  
                    Use the bilinear interpolation method to improve performance. 
                    --->
        <cfelse>
        <cfset ImageScaleToFit(myuploadedimage,75,75,"bilinear")>
        <!--- Specify the new filename as the source filename with 
                    "_thumbnail" appended to it. --->
        <cfset newImageName = fileUpload.serverDirectory & "/" & 
                    fileUpload.serverFilename & "_thumbnail." & 
                    fileUpload.serverFileExt>
        <!--- Save the thumbnail image to a file with the new filename. --->
        <cfimage source="#myuploadedImage#" action="write" 
                    destination="#newImageName#" overwrite="yes">
                    
                    <!--- section added from staffindex.cfm --->
                    <div class="mainContentContentWrapper">
  
                    
                    <!--- end new section from staffindex.cfm --->
        <cfoutput>
          <cflocation url="staffindex.cfm" addtoken="no">
          <p>Thank you for uploading the image. We have created a thumbnail for 
            your picture.</p>
          <p>
            <!--- Display the thumbnail image. --->
            <img src="#getFileFromPath(newImageName)#" /></p>
        </cfoutput>
      </cfif>
      <!--- If it is not a valid image file, delete it from the server. --->
      <cfelse>
      <cffile action="delete" 
                file="#fileUpload.serverDirectory#/#fileUpload.serverFile#">
      <cfoutput>
        <p>The file you uploaded,#fileUpload.clientFile#, was not a valid image.</p>
      </cfoutput>
    </cfif>
  </cfif>
</cfif>
<body>
<cfset variables.pageTitle="Main Template Page">
<cfparam name="attributes.pagetitle" default="Default Page Title">
<cfinput type="hidden" name="idemployees" value="#qBio.idemployees#">
 
</body>
 
 
 
<!--- This is the page I have been trying to work from.  This page updates the employee, then redirects back to staffindex.cfm --->
<cfif IsDefined("form.firstname")>
  <cfinvoke 
         component="crownfordcf9.Components.BioDetail"
         method="updateBio">
  <cfinvokeargument name="formData" value="#form#"/>
  </cfinvoke>
  <cflocation url="staffindex.cfm" addtoken="no">
  <cfelse>
  <cfinvoke 
 component="crownfordcf9.Components.Bios"
 method="getBioByQueryID"
 returnvariable="qBio">
  <cfinvokeargument name="idemployees" value="#url.idemployees#"/>
  </cfinvoke>
</cfif>
<cfinvoke 
 component="crownfordcf9.Components.Bios"
 method="getBioByID"
 returnvariable="employeeName"
 idemployees="#url.idemployees#"></cfinvoke>
<cfinvoke
  component="crownfordcf9.Components.BioDetail"
  method="getQBioDetail"
  returnvariable="qBioDetail">
<!--- CFC Query --->
<cfinvokeargument name="idemployees" value="#url.idemployees#">
</cfinvoke>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<cfparam name="attributes.pagetitle" default="Default Page Title">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<cfoutput>
  <title>#attributes.pagetitle#</title>
</cfoutput>
<link href="../mockup3Styles.css" rel="stylesheet" type="text/css" />
<script src="../Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<link href="../images/finalNavBar/navbar.css" rel="stylesheet" type="text/css" />
<script language="JavaScript1.2" type="text/javascript">
<!--
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
/* Functions that swaps down images. */
function MM_nbGroup(event, grpName) { //v6.0
var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])?args[i+1] : img.MM_up);
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) { img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    nbArr = document[grpName];
    if (nbArr) for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
      nbArr[nbArr.length] = img;
  } }
}
 
/* Functions that handle preload. */
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
 
//-->
</script>
<script language="JavaScript1.2" type="text/javascript" src="../mm_css_menu.js"></script>
<style type="text/css" media="screen">
@import url("../navbar.css");
#updateStaffBtn {
	float: left;
}
</style>
<!--- <cfmodule template="../tags/headtag.cfm" pagetitle="Update Bio"> --->
<link href="staffbiostyleupdates.css" rel="stylesheet" type="text/css" />
</head>
<body class="oneColElsCtrHdr">
<div id="container">
  <cfset variables.pageTitle="Update Staff">
  <cfinclude template="includes/header.cfm">
  <div id="mainContent">
    <cfform>
      <fieldset id="nameAndTitle">
      <legend class="perlegend">Personal Information</legend>
      <div class="group1input">
        <p>First Name:
          <cfinput type="text" name="firstname" value="#qBio.firstname#" maxlength="32">
        </p>
        <p>Last Name:
          <cfinput type="text" name="lastname" value="#qBio.lastname#" maxlength="32">
        </p>
      </div>
      <div class="group2Input">
        <p>Department:
          <cfinput type="text" name="department" value="#qBio.department#" maxlength="45">
        </p>
        <p>Title:
          <cfinput type="text" name="title" value="#qBio.title#" maxlength="45">
        </p>
      </div>
      </fieldset>
      <fieldset id="loginInfo">
      <legend id="logininformation">Login Information</legend>
      <div class="group1input">
        <p>User Name:
          <cfinput type="text" name="username" value="#qBio.username#" maxlength="45">
        </p>
        <p>Password:
          <cfinput type="text" name="password" value="#qBio.password#" maxlength="45">
        </p>
        <p>Permission Level:
          <cfinput type="text" name="permissionlevel" value="#qBio.permissionlevel#" maxlength="45">
        </p>
      </div>
      </fieldset>
      <fieldset id="phoneAndEmail">
      <legend id="phoneemailinfo">Phone &amp; Email</legend>
      <div class="group1input">
        <p>Home Phone:
          <cfinput type="text" name="homephone" value="#qBio.homephone#" maxlength="45">
        </p>
        <p>Mobile Phone :
          <cfinput type="text" name="mobilephone" value="#qBio.mobilephone#" maxlength="45">
        </p>
        <p>Best Contact Number:
          <cfinput type="text" name="contactnumber" value="#qBio.contactnumber#" maxlength="45">
        </p>
      </div>
      <div class="group2Input">
        <p>Email Main:
          <cfinput type="text" name="email_main" value="#qBio.email_main#" maxlength="45">
        </p>
        <p>Email Secondary :
          <cfinput type="text" name="email_secondary" value="#qBio.email_secondary#" maxlength="45">
        </p>
      </div>
      </fieldset>
      <fieldset id="imageEdit">
      <legend id="imageedit">Image Upload and Edit</legend>
      <div id="bioImgwrapper"> <cfoutput query="qBioDetail">
          <p> <img src="#qBioDetail.biothumb#" alt="" /> </p>
        </cfoutput> <a href=uploadimage.cfm>Upload</a> </div>
      <p>&nbsp;</p>
      </fieldset>
      <cfinput type="submit" name="updateStaffBtn" id="updateStaffBtn" value="Update Staff">
      <cfinput type="hidden" name="idemployees" value="#qBio.idemployees#">
    </cfform>
    <!-- end #mainContent -->
  </div>
  <cfinclude template="../includes/footer.cfm">
  <!-- end #container -->
</div>
</body>
</html>
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288:
289:
290:
291:
292:
293:
294:
295:
296:
297:
298:
299:
300:
301:
302:
303:
304:
305:
306:
307:
308:
309:
310:
311:
312:
313:
314:
315:
316:
317:
318:
319:
320:
321:
322:
323:
324:
325:
326:
327:
328:
329:
330:
331:
332:
333:
334:
335:
336:
337:
338:
339:
340:
341:
342:
343:
344:
345:
346:
347:
348:
349:
350:
351:
352:
353:
354:
355:
356:
357:
358:
359:
360:
361:
362:
363:
364:
365:
366:
367:
368:
369:
370:
371:
372:
373:
374:
375:
376:
377:
378:
379:
380:
381:
382:
383:
384:
385:
386:
387:
388:
389:
390:
391:
392:
393:
394:
395:
396:
397:
398:
399:
400:
401:
402:
403:
404:
405:
406:
407:
408:
409:
410:
411:
412:
413:
414:
415:
416:
417:
418:
419:
420:
421:
422:
423:
424:
425:
426:
427:
428:
429:
430:
431:
432:
433:
434:
435:
436:
437:
438:
439:
440:
441:
442:
443:
444:
445:
446:
447:
448:
449:
450:

Select allOpen in new window

 

by: myselfrandhawaPosted on 2009-08-10 at 16:34:04ID: 25065071

Anyways I recieved Your reply very late due to the cause that this EE delivered the mail late so i was unable to get the thing what u expected. In my next post you will have your answer in detail

Cheers

 

by: myselfrandhawaPosted on 2009-08-10 at 17:09:54ID: 25065276

Ok Here is the Updated Code You are looking for. 

P.S. There is no Bad Code anywhere, It is just understanding how u understand it

Regards

<cftry>
  <cfif structkeyexists(form, 'uploadedimage')>
  <cfset ImgDir = expandpath("images/staffimages/mainimages/")>
  <!--- full-size images dir --->
  <cfset ThumbDir = expandpath("images/staffimages/thumbs/")>
  <!--- thumbnail images dir --->
  <!--- check that full-size and thumbnail images dirs exist and create if necessary--->
  <cfif NOT DirectoryExists(ImgDir)>
    <cfdirectory action="create" directory="#ImgDir#" mode="777">
  </cfif>
  <cfif NOT DirectoryExists(ThumbDir)>
    <cfdirectory action="create" directory="#ThumbDir#" mode="777">
  </cfif>
  <cffile action="upload" filefield="uploadedimage" destination="#ImgDir#" nameconflict="makeunique" accept="image/*">
  <cfset resizefile = "#cffile.ServerFile#">
  <cfif IsImageFile("#ImgDir#\#resizefile#")>
    <cfimage action="resize" width="600" height="" source="#ImgDir#\#resizefile#" destination="#ImgDir#\rr_#resizefile#" overwrite="yes">
    <cfimage action="resize" width="100" height="" source="#ThumbDir#\#resizefile#" destination="#ThumbDir#\thumb_#resizefile#" overwrite="yes">
    <cfset form.uploadedimage = "rr_#resizefile#">
    <cfset form.uploadedimagethumb = "thumb_#resizefile#">
    <cfif FileExists('#ImgDir#\#resizefile#')>
      <cffile action="delete" file="#ImgDir#\#resizefile#">
    </cfif>
    <cfelse>
    <cfset msg = "File Cannot be resized, Not an Image File">
  </cfif>
  <cfcatch type="any">
    <cfset msg = "#cfcatch.Detail# #cfcatch.Message#">
    <cfoutput>#msg#</cfoutput>
  </cfcatch>
</cftry>
 
 
Now these two values:
 
<cfset form.uploadedimage = "rr_#resizefile#">
    <cfset form.uploadedimagethumb = "thumb_#resizefile#">
 
are the values you can use in your database for storing the names of the files.
 
>> File paths are then updated to the specific employee record in the database named crownford, table named employees, tablerows bioimage and biothumb, respectively. 
 
bioimage will contain FORM.UPLOADEDIMAGE
biothumb will contain FORM.uploadedImageThumb
 
Now when u view the image file, You have to put the full path like this:
 
<img src="#your Folder where you stored your files#\#biothumb#" border="0"/>
 
I hope the above code makes much more sense n u get what u looking after

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:

Select allOpen in new window

 

by: myselfrandhawaPosted on 2009-08-10 at 17:11:17ID: 25065283

In the code the second CFIMAGE tag is like this this:

<cfimage action="resize" width="100" height="" source="#ThumbDir#\#resizefile#" destination="#ThumbDir#\thumb_#resizefile#" overwrite="yes">

Change it to

<cfimage action="resize" width="100" height="" source="#ImgDir#\#resizefile#" destination="#ThumbDir#\thumb_#resizefile#" overwrite="yes">

 

by: MPEC_ADHDPosted on 2009-08-11 at 07:50:03ID: 25069716

Thank you for responding.  Please forgive any misunderstanding.  I am dealing with time constraints as well as a learning curve.  I am checking the code now and will comment in a moment.

 

by: MPEC_ADHDPosted on 2009-08-11 at 09:28:33ID: 25070792

I am getting a cfcatch error:

Context validation error for the cfcatch tag. The tag must be nested inside a CFTRY tag.

Yesterday, while waiting for a response, I think I figured out a couple of things:

1. Still the same is the Staff index page with the upload link. When clicked, the link passes the employee ID to the upload page: http://localhost:8501/crownfordcf9/staffbios/uploadimage.cfm?idemployees=34

2. The image file is browsed and then uploaded.  The action on submit takes the user to a page called updatebiowithimage.cfm, again passing the employee id variable (http://localhost:8501/crownfordcf9/staffbios/updatebiowithimage.cfm?idemployees=34) The existing data shows for the record as well as the newly created thumb. I can add or change info, click submit, and then I am taken back to staffindex.cfm with the updated info showing - except the new image info.

So far I can get the thumb to show on the updatebiowithimage.cfm page, but its using  <cfinput type="text" name="biothumb" width="200" value="#getFileFromPath(newImageName)#" maxlength="80"> which is temporary. But I can't get the image path to update in the database.  The record exists, so I don't want to create an entirly new record.

I attached the updated pages code to this post.

<!--- This is the page for uploading the image "upload.cfm"--->
<cfif IsDefined("form.firstname")>
  <cfinvoke 
         component="crownfordcf9.Components.BioDetail"
         method="updateBio">
  <cfinvokeargument name="formData" value="#form#"/>
  </cfinvoke>
  <cflocation url="staffindex.cfm" addtoken="no">
  <cfelse>
  <cfinvoke 
 component="crownfordcf9.Components.Bios"
 method="getBioByQueryID"
 returnvariable="qBio">
  <cfinvokeargument name="idemployees" value="#url.idemployees#"/>
  </cfinvoke>
</cfif>
<cfinvoke 
 component="crownfordcf9.Components.Bios"
 method="getBioByID"
 returnvariable="employeeName"
 idemployees="#url.idemployees#"></cfinvoke>
<cfinvoke
  component="crownfordcf9.Components.BioDetail"
  method="getQBioDetail"
  returnvariable="qBioDetail">
<!--- CFC Query --->
<cfinvokeargument name="idemployees" value="#url.idemployees#">
</cfinvoke>
 
 
<cfinvoke 
 component="crownfordcf9.Components.Bios"
 method="getAllBios"
 returnvariable="qBios">
</cfinvoke>
 
 
 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<cfmodule template="../tags/headtag.cfm" pagetitle="Upload Image">
<cfparam name="attributes.pagetitle" default="Default Page Title">
<link href="../mockup3Styles.css" rel="stylesheet" type="text/css" />
<link href="../formStyles.css" rel="stylesheet" type="text/css" />
<cfmodule template="../tags/headtag.cfm" pagetitle="Staff Index">
<style type="text/css">
<!--
-->
</style>
<link href="../uploadstylessecondary.css" rel="stylesheet" type="text/css" />
 
 
</head>
<body class="oneColElsCtrHdr"
"onload="MM_preloadImages('../images/home_btn_f3.png','../images/home_btn_f2.png','../images/home_btn_f4.png','../images/inventory_btn_f3.png','../images/inventory_btn_f2.png','../images/inventory_btn_f4.png','../images/video_btn_f3.png','../images/video_btn_f2.png','../images/finince_btn_f3.png','../images/finince_btn_f2.png','../images/finince_btn_f4.png','../images/serviceparts_btn_f3.png','../images/serviceparts_btn_f2.png','../images/serviceparts_btn_f4.png','../images/specials_btn_f3.png','../images/specials_btn_f2.png','../images/specials_btn_f4.png','../images/departments_btn_f3.png','../images/departments_btn_f2.png','../images/departments_btn_f4.png','../images/logout_f3.png','../images/logout_f2.png','../images/logout_f4.png')">
<div id="container">
  <cfset variables.pageTitle="Upload Image for " & variables.employeeName & "?">
  <cfinclude template="includes/header.cfm">
  <div id="mainContentContentWrapper">
    <!--- This code creates a form with one field where the user enters the image file to upload. --->
    <fieldset id="imageuploadfieldset">
    <legend class="imageupload">Image Upload</legend>
    <cfform action="updatebiowithimage.cfm?idemployees=#qBios.idemployees#" method="post" enctype="multipart/form-data">
      <div id="uploadwrapper">
        <h4>Please upload an image:</h4>
        <p>
          <cfinput type="file" name="uploadedimage">
        </p>
        <p>
          <cfinput type="submit" value="Send Image" name="Submit">
        </p>
       <cfinput type="hidden" name="idemployees" value="#qBio.idemployees#">
      </div>
    </cfform>
    </fieldset>
    
  </div>
  <cfinclude template="includes/footer.cfm">
</div>
</body>
 
<!-----------------------End: upload.cfm-------------------!>
 
<!--------------Start: updatebiowithimage.cfm-----------------!>
 
<!--- This is the updatebiowithimage.cfm page 
It is not only for updating the image to the database record, but for updating any other record information based on the URL id passed in--->
<cfif IsDefined("form.firstname")>
  <cfinvoke 
         component="crownfordcf9.Components.BioDetail"
         method="updateBio">
  <cfinvokeargument name="formData" value="#form#"/>
  </cfinvoke>
  <cflocation url="staffindex.cfm" addtoken="no">
  <cfelse>
  <cfinvoke 
 component="crownfordcf9.Components.Bios"
 method="getBioByQueryID"
 returnvariable="qBio">
  <cfinvokeargument name="idemployees" value="#url.idemployees#"/>
  </cfinvoke>
</cfif>
<cfinvoke 
 component="crownfordcf9.Components.Bios"
 method="getBioByID"
 returnvariable="employeeName"
 idemployees="#url.idemployees#"></cfinvoke>
<cfinvoke
  component="crownfordcf9.Components.BioDetail"
  method="getQBioDetail"
  returnvariable="qBioDetail">
<!--- CFC Query --->
<cfinvokeargument name="idemployees" value="#url.idemployees#">
</cfinvoke>
<cfset thisDir = expandPath(".")>
 
<cfif structKeyExists(form,"uploadedimage") and len(trim(form.uploadedimage))>
  <!--- Use the cffile tag to upload the image file. --->
  <cffile action="upload" 
    	fileField="uploadedimage" 
        destination="#thisDir#" 
        result="fileUpload" 
        nameconflict="overwrite">
  <!--- Determine whether the image file is saved. --->
  <cfif fileUpload.fileWasSaved>
    <!--- Determine whether the saved file is a valid image file. --->
    <cfif IsImageFile("#fileUpload.serverfile#")>
      <!--- Read the image file into a variable called myImage. --->
      <cfimage action="read" source="#fileUpload.serverfile#" name="myuploadedimage">
      <!--- Determine whether the image file exceeds the size limits. --->
      <cfif ImageGetHeight(myuploadedimage) gt 1600 or ImageGetWidth(myuploadedimage) gt 1600>
        <!--- If the file is too large, delete it from the server. --->
        <cffile action="delete" 
                    file="#fileUpload.serverDirectory#/#fileUpload.serverFile#">
        <cfoutput>
          <p>The image you uploaded was too large. It must be less than 800 pixels wide 
            and 800 pixels high. Your image was#imageGetWidth(myuploadedimage)#pixels wide 
            and#imageGetHeight(myuploadedimage)#pixels high.</p>
        </cfoutput>
        <!--- If the image is valid and does not exceed the size limits, 
                    create a thumbnail image from the source file that is 75-pixels 
                    square, while maintaining the aspect ratio of the source image.  
                    Use the bilinear interpolation method to improve performance. 
                    --->
        <cfelse>
        <cfset ImageScaleToFit(myuploadedimage,75,75,"bilinear")>
        <!--- Specify the new filename as the source filename with 
                    "_thumbnail" appended to it. --->
        <cfset newImageName = fileUpload.serverDirectory & "/" & 
                    fileUpload.serverFilename & "_thumbnail." & 
                    fileUpload.serverFileExt>
        <!--- Save the thumbnail image to a file with the new filename. --->
        <cfimage source="#myuploadedImage#" action="write" 
                    destination="#newImageName#" overwrite="yes">
                    
                    <!--- section added from staffindex.cfm --->
                    <div class="mainContentContentWrapper">
 
       
      </cfif>
      <!--- If it is not a valid image file, delete it from the server. --->
      <cfelse>
      <cffile action="delete" 
                file="#fileUpload.serverDirectory#/#fileUpload.serverFile#">
      <cfoutput>
        <p>The file you uploaded,#fileUpload.clientFile#, was not a valid image.</p>
      </cfoutput>
    </cfif>
  </cfif>
</cfif>
 
<head>
<cfparam name="attributes.pagetitle" default="Default Page Title">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<cfoutput>
  <title>#attributes.pagetitle#</title>
</cfoutput>
<link href="../mockup3Styles.css" rel="stylesheet" type="text/css" />
<script src="../Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<link href="../images/finalNavBar/navbar.css" rel="stylesheet" type="text/css" />
<script language="JavaScript1.2" type="text/javascript">
<!--
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
/* Functions that swaps down images. */
function MM_nbGroup(event, grpName) { //v6.0
var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])?args[i+1] : img.MM_up);
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) { img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    nbArr = document[grpName];
    if (nbArr) for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
      nbArr[nbArr.length] = img;
  } }
}
 
/* Functions that handle preload. */
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
 
//-->
</script>
<script language="JavaScript1.2" type="text/javascript" src="../mm_css_menu.js"></script>
<style type="text/css" media="screen">
@import url("../navbar.css");
#updateStaffBtn {
	float: left;
}
.oneColElsCtrHdr #container {
	color: #FFFFFF;
}
</style>
<!--- <cfmodule template="../tags/headtag.cfm" pagetitle="Update Bio"> --->
<link href="staffbiostyleupdates.css" rel="stylesheet" type="text/css" />
<link href="../staffBioStyles.css" rel="stylesheet" type="text/css">
<link href="../staffStyles.css" rel="stylesheet" type="text/css">
</head>
<body class="oneColElsCtrHdr">
<div id="container">
  <cfset variables.pageTitle="Update Staff">
  <cfinclude template="includes/header.cfm">
  <div id="mainContent">
    <cfform>
      <fieldset id="nameAndTitle">
      <legend class="perlegend">Personal Information</legend>
      <div class="group1input">
        <p>First Name:
          <cfinput type="text" name="firstname" value="#qBio.firstname#" maxlength="32">
        </p>
        <p>Last Name:
          <cfinput type="text" name="lastname" value="#qBio.lastname#" maxlength="32">
        </p>
      </div>
      <div class="group2Input">
        <p>Department:
          <cfinput type="text" name="department" value="#qBio.department#" maxlength="45">
        </p>
        <p>Title:
          <cfinput type="text" name="title" value="#qBio.title#" maxlength="45">
        </p>
      </div>
      </fieldset>
      <fieldset id="loginInfo">
      <legend id="logininformation">Login Information</legend>
      <div class="group1input">
        <p>User Name:
          <cfinput type="text" name="username" value="#qBio.username#" maxlength="45">
        </p>
        <p>Password:
          <cfinput type="text" name="password" value="#qBio.password#" maxlength="45">
        </p>
        <p>Permission Level:
          <cfinput type="text" name="permissionlevel" value="#qBio.permissionlevel#" maxlength="45">
        </p>
      </div>
      </fieldset>
      <fieldset id="phoneAndEmail">
      <legend id="phoneemailinfo">Phone &amp; Email</legend>
      <div class="group1input">
        <p>Home Phone:
          <cfinput type="text" name="homephone" value="#qBio.homephone#" maxlength="45">
        </p>
        <p>Mobile Phone :
          <cfinput type="text" name="mobilephone" value="#qBio.mobilephone#" maxlength="45">
        </p>
        <p>Best Contact Number:
          <cfinput type="text" name="contactnumber" value="#qBio.contactnumber#" maxlength="45">
        </p>
      </div>
      <div class="group2Input">
        <p>Email Main:
          <cfinput type="text" name="email_main" value="#qBio.email_main#" maxlength="45">
        </p>
        <p>Email Secondary :
          <cfinput type="text" name="email_secondary" value="#qBio.email_secondary#" maxlength="45">
        </p>
      </div>
      </fieldset>
      <fieldset id="imageEdit">
      <legend id="imageedit">Image Upload and Edit</legend>
      <div id="bioImgwrapper">
       <cfoutput>
                    
          <p>Thank you for uploading the image for . We have created a thumbnail for 
            your picture.</p>
          <p>
            <!--- Display the thumbnail image. --->
            <img src="#getFileFromPath(newImageName)#" /> </p>
        </cfoutput>
        	<cfinput type="text" name="bioimage" width="200" value="#qBio.bioimage#" maxlength="80">
            <cfinput type="text" name="biothumb" width="200" value="#getFileFromPath(newImageName)#" maxlength="80">
             
        </div>
      </fieldset>
      <cfinput type="submit" name="updateStaffBtn" id="updateStaffBtn" value="Update Staff">
      <cfinput type="hidden" name="idemployees" value="#qBio.idemployees#">
    </cfform>
    <!-- end #mainContent -->
  </div>
  <cfinclude template="../includes/footer.cfm">
  <!-- end #container -->
</div>
</body>
 
<!---End updatebiowithimage.cfm---!>
 
Here is the companent function that I am using:
 
<cffunction name="updateBio" access="public" returntype="void">
	<cfargument name="formData" type="struct" required="yes">
    
    <cfquery datasource="crownford">
    	UPDATE employees
        SET firstname = '#formData.firstname#',
        	lastname = '#formData.lastname#',
            department = '#formData.department#',
            bioimage = '#formData.bioimage#',
            biothumb = '#formData.biothumb#',
            biotext = '#formData.biotext#', 
            contactnumber = '#formData.contactnumber#', 
            datestart = '#formData.datestart#',
            email_main = '#formData.email_main#', 
            email_secondary = '#formData.email_secondary#', 
            homephone = '#formData.homephone#', 
            mobilephone = '#formData.mobilephone#', 
            permissionlevel = '#formData.permissionlevel#', 
            title = '#formData.title#', 
            username = '#formData.username#'
        WHERE idemployees = #formData.idemployees#
    </cfquery>
</cffunction>
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288:
289:
290:
291:
292:
293:
294:
295:
296:
297:
298:
299:
300:
301:
302:
303:
304:
305:
306:
307:
308:
309:
310:
311:
312:
313:
314:
315:
316:
317:
318:
319:
320:
321:
322:
323:
324:
325:
326:
327:
328:
329:
330:
331:
332:
333:
334:
335:
336:
337:
338:
339:
340:
341:
342:
343:
344:
345:
346:
347:
348:
349:
350:
351:
352:
353:
354:
355:
356:
357:
358:
359:
360:
361:
362:

Select allOpen in new window

 

by: myselfrandhawaPosted on 2009-08-11 at 19:32:37ID: 25075300

<pre id="codeSnippet385484" class="prettyprint">If the path is the issue where u need to store and fetch images:

i suggest u to make a variable in Application.cfc or Application.cfm file as:

<cfset request.img = "E:\domains\ursite\images\staffimages">
</pre>

now in ur database store the filename as:
 
<cfquery datasource="crownford">
    	UPDATE employees
        SET firstname = '#formData.firstname#',
        	lastname = '#formData.lastname#',
            department = '#formData.department#',
            bioimage = '#request.img#\#formData.bioimage#',
            biothumb = '#request.img#\#formData.biothumb#',
            biotext = '#formData.biotext#', 
            contactnumber = '#formData.contactnumber#', 
            datestart = '#formData.datestart#',
            email_main = '#formData.email_main#', 
            email_secondary = '#formData.email_secondary#', 
            homephone = '#formData.homephone#', 
            mobilephone = '#formData.mobilephone#', 
            permissionlevel = '#formData.permissionlevel#', 
            title = '#formData.title#', 
            username = '#formData.username#'
        WHERE idemployees = #formData.idemployees#
    </cfquery>
 
This way it will store complete path in database or you can do i thing
 
store the files in database as it is:
 
when u fetch ur images:
 
write as:
 
<img src="#request.img#\#urquery.bioimage#" border="0"/>
 
both ways will work
 
The second approch is best
 
Let me know if u have something else in mind
 
Cheers

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:

Select allOpen in new window

 

by: MPEC_ADHDPosted on 2009-08-13 at 20:42:09ID: 25095107

Ok. its getting close.  My one remaining issue is that my rename is giving me an absolute file path, but without the "\" between the files.  

<cfset newImageName = fileUpload.serverDirectory & "/" &
                   fileUpload.serverFilename & "_thumbnail." &
                   fileUpload.serverFileExt>
               <!--- Save the thumbnail image to a file with the new filename. --->
               <cfimage source="#myImage#" action="write"
                   destination="#newImageName#" overwrite="yes">
               <cfoutput>
               <p>


It comes out looking like this: "C:ColdFusion9wwwrootcrownfordcf9staffbios/paoletta_website_pic_thumbnail.jpg"

What syntax do I use to get more of a root style folder path like:
"../staffimages/thumb#mynewimage#"  By the way, I tried the previous and it doesn't work.
We get this solved and I will award points.

<cfset thisDir = expandPath(".")>
<!--- Determine whether the form is uploaded with the image. --->
<cfif structKeyExists(form,"image") and len(trim(form.image))>
    <!--- Use the cffile tag to upload the image file. --->
    <cffile action="upload" 
            fileField="image" 
            destination="#thisDir#" 
            result="fileUpload"
        	nameconflict="overwrite">
    <!--- Determine whether the image file is saved. --->
    <cfif fileUpload.fileWasSaved>
    <!--- Determine whether the saved file is a valid image file. --->
        <cfif IsImageFile("#fileUpload.serverfile#")>
    <!--- Read the image file into a variable called myImage. --->
            <cfimage action="read" source="#fileUpload.serverfile#" name="myImage">
            <!--- Determine whether the image file exceeds the size limits. --->
            <cfif ImageGetHeight(myImage) gt 800 or ImageGetWidth(myImage) gt 800>
                <!--- If the file is too large, delete it from the server. --->
                <cffile action="delete"
                    file="#fileUpload.serverDirectory#/#fileUpload.serverFile#">
                <cfoutput>
                <p>
                The image you uploaded was too large. It must be less than 800 pixels wide
                    and 800 pixels high. Your image was #imageGetWidth(myImage)# pixels wide
                    and #imageGetHeight(myImage)# pixels high.
                </p>
                </cfoutput>
                <!--- If the image is valid and does not exceed the size limits,
                    create a thumbnail image from the source file that is 75-pixels
                    square, while maintaining the aspect ratio of the source image. 
                    Use the bilinear interpolation method to improve performance.
                    --->
            <cfelse>
 
    <cfset ImageScaleToFit(myImage,75,75,"bilinear")>
                <!--- Specify the new filename as the source filename with
                    "_thumbnail" appended to it. --->
                <cfset newImageName = fileUpload.serverDirectory & "/" &
                    fileUpload.serverFilename & "_thumbnail." &
                    fileUpload.serverFileExt>
                <!--- Save the thumbnail image to a file with the new filename. --->
                <cfimage source="#myImage#" action="write"
                    destination="#newImageName#" overwrite="yes">
                <cfoutput>
                <p>
                Thank you for uploading the image. We have created a thumbnail for
                    your picture.
                </p>
                <p>
                <!--- Display the thumbnail image. --->
                <img src="#getFileFromPath(newImageName)#">
                </p>
                </cfoutput> 
               <!--- upload to database ---> 
                <cfset formData.idemployees="#idemployees#">
          <cfset biothumb="#newImageName#">         
         <cfquery name="insertImage" datasource="crownford">
         UPDATE employees 
         SET 
         biothumb = '#biothumb#'
         WHERE idemployees = #formData.idemployees#
         </cfquery>
               
                
                
                  
            </cfif>
        <!--- If it is not a valid image file, delete it from the server. --->
        <cfelse>
            <cffile action="delete"
                file="#fileUpload.serverDirectory#/#fileUpload.serverFile#">
            <cfoutput>
            <p>
            The file you uploaded, #fileUpload.clientFile#, was not a valid image.
            </p>
            </cfoutput>
        </cfif>
    </cfif>
</cfif>

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:

Select allOpen in new window

 

by: myselfrandhawaPosted on 2009-08-13 at 20:52:49ID: 25095143

>> <img src="#getFileFromPath(newImageName)#">

Why are u using the above line

I told u in my previous post to set a variable in Application.cfc or Application.cfm in the OnrequestStart Mehod of Application.cfc and anywhere in Application.cfm which will point to the exact path of your stored thumbnail.

You are making the uploaded image to find its path which will lead to issues.
 
<cfset newImageName = fileUpload.serverDirectory & "/" &
                    fileUpload.serverFilename & "_thumbnail." &
                    fileUpload.serverFileExt>
 
Suppose you have the serverfilename and serverfileext variables in your hand
 
Just use
 
<cfset newImageName = #request.img# & "\" &
                    fileUpload.serverFilename & "_thumbnail." &
                    fileUpload.serverFileExt>
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:

Select allOpen in new window

 

by: MPEC_ADHDPosted on 2009-08-13 at 21:23:25ID: 25095247

I created a function in my Application.cfc:
<cffunction name="requestimage" access="public" returntype="string">
   
   <cfset request.img = "C:\coldfusion9\wwwroot\crownfordcf9\staffimages">
   
   
   </cffunction>


I called it on my action page::
<cfinvoke
                     component="crownfordcf9.Application"
                    method="requestimage"
                    returnvariable="#request.img#">
                   </cfinvoke>

                <cfset newImageName = #request.img# & "\" &
                   fileUpload.serverFilename & "_thumbnail." &
                   fileUpload.serverFileExt>
               <!--- Save the thumbnail image to a file with the new filename. --->
               <cfimage source="#myImage#" action="write"
                   destination="#newImageName#" overwrite="yes">
               <cfoutput>


I got "Element IMG is undefined in REQUEST"

Any ideas?

 

by: myselfrandhawaPosted on 2009-08-14 at 00:52:31ID: 25095920

You are on right track but the way is Different. I guess you are using Application.cfc

You might have OnRequestStart Method in your Application.cfc as such below:

<cffunction name="onRequestStart" returntype="boolean">
  <!--- Set up request variables here. --->
  <cfset request.basePath = "C:\coldfusion9\wwwroot\crownfordcf9\staffimages\">
<cfreturn true>
</cffunction>
 
Now u need to invoke this function anywhere because request scope is global and it will be avaliable to whole of your application.
 
Now u have defined the img path in the request scope, you can just get the image by using this path as:
 
as You are doing something like this:
 
<cfset newImageName = #request.img# & "\" &
                    fileUpload.serverFilename & "_thumbnail." &
                    fileUpload.serverFileExt>
 
This will fetch the path of the image which is stored fileUpload.serverFileName is say IMAGE_thumbnail.jpg
 
So my point here is why u are using the 
 
fileUpload.serverFilename & "_thumbnail." &
                    fileUpload.serverFileExt>
 
the filename and extention is stored in the database or not yet. if stored, why not just use the biothumb which will automatically fetch the thumbnail image name and u can just refernce it with the path and image name as i provided above
Ok I suppose your biothumb contains the image name as:
 
image_thumbnail.jpg which is stored in the the path 
 
C:\coldfusion9\wwwroot\crownfordcf9\staffimages\
 
Therefore you can just point to this file as:
 
<img src="#request.img##biothumb#" border="0"/>
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:

Select allOpen in new window

 

by: myselfrandhawaPosted on 2009-08-14 at 00:53:21ID: 25095927

<cffunction name="onRequestStart" returntype="boolean">
  <!--- Set up request variables here. --->
  <cfset request.basePath = "C:\coldfusion9\wwwroot\crownfordcf9\staffimages\">
<cfreturn true>
</cffunction>

The above function is like this:

<cffunction name="onRequestStart" returntype="boolean">
  <!--- Set up request variables here. --->
  <cfset request.img = "C:\coldfusion9\wwwroot\crownfordcf9\staffimages\">
<cfreturn true>
</cffunction>
                                              
1:
2:
3:
4:
5:

Select allOpen in new window

 

by: MPEC_ADHDPosted on 2009-08-14 at 08:14:14ID: 25098897

I tried your suggestion, but was thrown an error that I can't have two OnRequestStart Functions. I already am using onRequestStart to redirect a user to the login page.

I would be willing to modify.  I appreciate your help on this.

Any  ideas?

<cfcomponent>
 
	<cfset this.name="crownford">
 
	<cffunction name="onRequestStart" access="public" returntype="void">
    
    
		
        
		<cfif NOT IsDefined("Application.datasource")>
        <cfset application.datasource="crownford">
        
        </cfif>
        
        <cflogin>
        
        <cfif IsDefined("form.username")>
        
        <cfquery datasource="#application.datasource#"
        	name="qUser">
            SELECT * FROM employees
            WHERE username = '#form.username#' AND
            	password = '#form.password#'
         </cfquery>
         
         <cfif qUser.RecordCount IS 1>
         	<cfloginuser name="#qUser.firstname# #qUser.lastname#"
            	password="#form.password#"
                roles="#qUser.permissionlevel#">
			<cfelse>
            	<cfinclude template="staffbios/login.cfm">
        		<cfabort>
          </cfif>
            <cfelse>
           		<cfinclude template="staffbios/login.cfm">
        		<cfabort> 
        </cfif>
	
      
        </cflogin>
        
	</cffunction>
    
   

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:

Select allOpen in new window

 

by: myselfrandhawaPosted on 2009-08-14 at 08:34:33ID: 25099168

as u are already using onRequest Start, Just define the varibale as:

<cfset request.img = "YourImagePath">
 in th existing OnRequestStart Method

and then try and notify me what happened

 

by: MPEC_ADHDPosted on 2009-08-14 at 09:02:37ID: 25099564

Whew!!  Got it.
Works like a charm! Thank you for your insight.

OK. What I did was create a separate Component called "Requests" to call OnRequestStart for the Path.  That way it doesn't (so far) conflict with the redirect to the login page.

Since I went through so much on this, Let me explain to any one who reads this what  the App does and how it is accomplished:

1. User starts on an index page which displays info on employees, i.e. Name, Phone, department, title, and the ever elusive image. Included in each row are options to: edit, delete, view details in a single page format, or upload in image. In this case, user then clicks on the "upload" link to upload an image for the employee. The employee ID  is passed via url.
2. User is taken to the upload.cfm page, which shows the specific employee name in variables.pageTitle verifying the correct employee, browses for the image, then clicks upload.
3. User is rediredted to action.cfm where the upload is verified that it exists, then resized. A thumbnail image is then created.
4.  Main image is saved to the "../staffimages/mainimages/  the thumbnail image is saved to the "../staffimages/thumbs/ thanks to the wonderful suggestion by myselfrandhawa is made simple and persistant by creating a cfc to house an onRequestStart function to call the path.
5. File paths are then updated to the specific employee record in the database named #yourdatabasenamehere#, table named employees, tablerows bioimage and biothumb, respectively.
6. User is then redirected back to the staffindex.cfm where the newly uploaded image should now be showing. (the thumbnail image) --->

What I have learned

if you want to have a path relative to the root folder, create a separate component and invoke the path:

<cfcomponent>
   <cffunction name="onRequestStart" returntype="boolean">
 <!--- Set up request variables here. --->
 <cfset request.basePath = "../staffimages"& "/" & "thumbs" & "/">
<cfreturn true>
</cffunction>

</cfcomponent>


cfinvoke
                     component="#replace with your root folder#.Components.Requests"
                    method="onRequestStart"
                    returnvariable="onRequestStartRet">
                   </cfinvoke>

               <cfset newImageName = #request.basePath# & "\" &
                   fileUpload.serverFilename & "_thumbnail." &
                   fileUpload.serverFileExt>


This is a great way to Upload, rename, save, and update your image to an Application.

Thank you again to myselfrandhawa for all your help!   I am sure I will have more questions in the future.

Cheers


 

by: MPEC_ADHDPosted on 2009-08-14 at 09:06:59ID: 31613296

I am giving an "A" for patience and persistence.  I think my question was difficult because of the specificity of my request. The answer gave insight into the correct direction, which was really exactly what I needed for the question.

 

by: MPEC_ADHDPosted on 2009-08-14 at 10:35:32ID: 25100408

One more thing.  I totally skipped asking how to write the main image path and variable to the database and filing it under ../staffimages.  I tried a couple of different things, but I am still missing something.  Help!!

Thanx.

 

by: myselfrandhawaPosted on 2009-08-14 at 10:44:04ID: 25100462

I told u already in my previous posts, You can store the uploaded file in the form

as like

<cfset form.uploadedfile = #cffile.serverfile#>

 

by: MPEC_ADHDPosted on 2009-08-14 at 11:09:57ID: 25100713

Nevermind.  I answered my own question.

I created an additional request path,  added the additional field bioimage to the query, and saved the new image as newMainImage Name.

<cfset newMainImageName = #request.pathMainImage# & "\" &
                   fileUpload.serverFilename & "_thumbnail." &
                   fileUpload.serverFileExt>
                 <cfimage source="#myImage#" action="write"
                   destination="#newMainImageName#" overwrite="yes">


Now I understand why it is so difficult to answer certain questions because they are so application specific!!  Hopes this helps someone.

Thank you for your help.

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...