Welcome to Dream.In.Code
Getting Help is Easy!

Join 132,668 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,147 people online right now. Registration is fast and FREE... Join Now!




Saving image links to access and retreiving to CFMX7

 
Reply to this topicStart new topic

Saving image links to access and retreiving to CFMX7, I need to save the image path in access and have it show up in <cfd

sydtek22
post 12 Jul, 2007 - 01:27 PM
Post #1


New D.I.C Head

*
Joined: 12 Jul, 2007
Posts: 1


My Contributions


There are a lot of advanced things I'm working on, and I have no clue on what I'm doing. I would like for basics just to work first. I have only been studying ColdFusion for two months. Ultimately I would like for all images that are uploaded during the application process, be tagged with a unique number and stored in their own folder. That way I don't pull all images on the server for one application. But first thing first

Here is my code for saving the image path:

<cfif form.ul_path gt "">
<CFFILE
ACTION="Upload"
FILEFIELD="ul_path"
DESTINATION="\\Aoc-memhub-s1.corp.ds.fedex.com\101de00000\Uploads\Pics\"
NAMECONFLICT="MakeUnique"
accept="image/gif,image/jpeg,image/jpg,image/bmp">
<cftry>
<cfset imgname = cffile.serverfile>
<cfcatch>
<CFSET SendNote = URLEncodedFormat("Error with upload.<br>#cfcatch.message#")>
<cflocation addtoken="no" url="#CGI.SCRIPT_NAME#?Note=#SendNote#">
</cfcatch>
</cftry>
</cfif>

Inserting into database:

<cfquery name="InsertPic" datasource="asf">
INSERT INTO ASFdata4
(ul_path)
VALUES
('#imgname#')
</cfquery>

And for retrieving it, I have not even begun because I'm not sure about this part.
Any help in the right direction or reference would be greatly appreciated.
Thanks
User is offlineProfile CardPM

Go to the top of the page

ajwsurfer
post 14 Aug, 2007 - 07:41 AM
Post #2


D.I.C Regular

Group Icon
Joined: 24 Oct, 2006
Posts: 292



Thanked 2 times

Dream Kudos: 50
My Contributions


Here is a file that may be of interest to you. The name of the file is "actUploadFile.cfm".

Let me know if you would like the unzip.cfm file, it contains a single scripted function: "gunzipFile()".

CODE
<!---
' Purpose: Action page to frmUploadFile.cfm
' --->
<!--- include the unzip utility --->
<cfinclude template="unzip.cfm">

<!--- set the destination directory and filename --->
<cfset sDestination = "#request.gsRoot#\files\upload\#url.pid#\#url.theme#.#url.ext#">

<!--- if the file being uploaded exists from a previous upload, delete it --->
<cfif FileExists(#sDestination#)>
    <cffile action="delete" file="#sDestination#">
</cfif>

<!--- move the file from the temp folder to the upload folder --->
<cffile action="move" source="#request.gsRoot#\files\temp\#form.filename#"
    destination="#sDestination#">

<cfset  success = gunzipFile(sDestination)>    
<cfoutput>
  success: #success#<p />
</cfoutput>  


<!--- update the date uploaded --->
<cfquery name="updDate" datasource="#request.dsn#">
    UPDATE ProjectThemes
    SET
        DateUploaded = #CreateODBCDateTime(Now())#
    WHERE ProjectID = <cfqueryparam cfsqltype="cf_sql_integer" value="#url.pid#">
        AND PhaseID = <cfqueryparam cfsqltype="cf_sql_smallint" value="1">
        AND StageId = <cfqueryparam cfsqltype="cf_sql_smallint" value="1">
        AND Theme = <cfqueryparam cfsqltype="cf_sql_varchar" value="#url.theme#">
        AND Extension = <cfqueryparam cfsqltype="cf_sql_varchar" value="#url.ext#">
</cfquery>

<!--- store the metadata, if appropriate --->
<cfif IsDefined("form.MetaID")>
    <cfset bIsStored = fStoreProjectMetadata(url.pid, sParameterID, form.MetaID, bIsMetadata)>
</cfif>

<!--- leave the action page to prevent double submits using Refresh --->
<cflocation url="phase1_themes.cfm?pid=#url.pid#">



wink2.gif
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/23/08 05:55AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month