I have the following template that I am using to upload files into AMAZON S3. I'll display the template right here:

<cftry>
<!---ACCESS KEY ID = 
SECRET ACCESS ID = 
BUCKET NAME = cic-audio
FILE NAME = amazon_s3_test.txt--->

<cfparam name="URL.step" default="view">
<cfoutput>
        <cfif URL.step eq "view">
                <cfscript>
                        // IMPORTANT: Set your key, accesskey and bucket here
                        Variables.accessKeyId = "";
                        Variables.secretAccessKey = "";
                        Variables.BucketName='cic-audio'; // Put your bucket name here
                        // Map S3 to Joe Danziger's S3 REST Wrapper (http://amazons3.riaforge.org/)
                        // Place the s3.cfc in the same directory as this file
                        S3=createObject("component","S3"); // 
                        Variables.RedirectURL='http://#CGI.HTTP_HOST##CGI.SCRIPT_NAME#?step=upload';
                        Variables.Expiration=Dateformat(DateAdd("d", 7, "#now()#"), "yyyy-mm-dd")&'T00:00:00Z'; // Expiry Date
                        Variables.Path='TestPath/'; // the will be put in from of every file uploaded with this form
                        Variables.Auth='authenticated-read'; // secure the file - you can always change this later. Set it to 'public-read' for public access
                        Variables.ContenType='';
                        Variables.Filesize=250000000; // max allowed upload size in Bytes
                        // Init
                        S3.init('#Variables.accessKeyId#','#Variables.secretAccessKey#');
                </cfscript>
                <h1>S3 Form POST Upload</h1>
                <cfsavecontent variable="Variables.S3policy">                   
                  {"expiration": "#Variables.Expiration#",
                          "conditions": [ 
                                {"bucket": "#Variables.BucketName#"}, 
                                ["starts-with", "$key", "#Variables.Path#"],
                                {"acl": "#Variables.Auth#"},
                                {"success_action_redirect": "#Variables.RedirectURL#"},
                                ["starts-with", "$Content-Type", "#Variables.ContenType#"],
                                ["content-length-range", 0, #Variables.FileSize#]
                          ]
                        }
                </cfsavecontent>
                <cfset Variables.PolicyBase64 = ToBase64(Variables.S3policy)>   
                Select a file:
                <form name="s3upload" id="s3upload" action="https://#Variables.BucketName#.s3.amazonaws.com/" method="post" enctype="multipart/form-data">
                  <input type="hidden" name="key" value="#Variables.Path#${filename}">
                  <input type="hidden" name="AWSAccessKeyId" value="#Variables.accessKeyId#"> 
                  <input type="hidden" name="acl" value="#Variables.Auth#"> 
                  <input type="hidden" name="success_action_redirect" value="#Variables.RedirectURL#">
                  <input type="hidden" name="policy" value="#Variables.PolicyBase64#">
                  <input type="hidden" name="signature" value="#S3.createSignature(Variables.PolicyBase64)#">
                  <input type="hidden" name="Content-Type" value="video">
                  <input name="file" id="file" type="file">&nbsp;<input type="submit" />
                </form>
                
        <cfelseif URL.step eq "upload">
                <h1>Response from Amazon S3</h1>
                Bucket: #URL.bucket#<br />
                ETag: #URL.etag#<br />
                Key: #URL.key#
        </cfif>
</cfoutput>

<cfcatch type="any">
	<h1>ERROR!</h1>
	<cfdump var="#cfcatch#" />
</cfcatch>
</cftry>

Now my question is how do I include the following input/output tags into this template to make it load files automatically:

<!----blah blah blah blah logic from above processing an audio file---->

<!---assuming that the audio file was transformed correctly. --->

<!---we know the following about the audio file--->
	<cfset variables.s3_target_directory = "TestPath" />
	<cfset variables.file_name = "amazon_s3_test.txt" />
	<cfset variables.file_location = "fakeaudio" />


<!---make s3 upload--->
	<cfinclude template="amazonS3Load.cfm" />
	
	
<!---blah blha blah blah down stream logic....--->

What I need this code to do in simple terms. Basically you have a file, the user will have to figure out what file, and where is the file located. Through s3upload.cfm I need the code to process on our server to handle the API call and file transfer into the Amazon S3 Cloud. So I need the process of uploading the file to be automated for the end user. Hope that makes some sense. Thanks!

its a bit of a long tale ... but in php its a simple job

I'll come back with some code I hope my .net skill are not too rusty :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.