Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
Dmitry.Obukhov  
#1 Posted : Tuesday, December 7, 2010 10:47:06 PM(UTC)
Dmitry.Obukhov

Rank: Advanced Member

Groups: Member
Joined: 5/29/2010(UTC)
Posts: 1,310

Thanks: 8 times
Was thanked: 111 time(s) in 111 post(s)
In this forum thread you will find the sample application which illustrates how to use Image Uploader 7.x with ColdFusion. Here you will see how to insert the uploader to ColdFusion page, receive uploads on server side and display uploaded data.

Image Uploader is embedded into a web page via <script type="text/javascript"> block:
Code:

<script type="text/javascript">
		var uploader = $au.uploader({
			id: 'Uploader1',
			width: '800px',
			height: '500px',
			licenseKey: 'XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXXX',
			activeXControl: {
				codeBase: 'Scripts/ImageUploader7.cab'
			},
			javaControl: {
				codeBase: 'Scripts/ImageUploader7.jar'
			},
			// Configure converters
			converters: [
				// Source file 
				{	mode: '*.*=SourceFile' },
				// Thumbnail settings
				{
					mode: '*.*=Thumbnail', 
					thumbnailFitMode: 'Fit',
					thumbnailWidth: 150, 
					thumbnailHeight: 150,
					thumbnailJpegQuality: 90,
				}],
			 uploadSettings: {
				actionUrl: 'upload.cfm',
				redirectUrl: 'gallery.cfm',
				filesPerPackage: 1,
			}
		});
		uploader.writeHtml();
</script>

Designing new version of the uploader we paid attention to create it customizable, so you will be able to setup the upload solution to meet your requirements closer. You can find other Image Uploader 7.x settings in the JavaScript References section of the documentation.

Here is the server-side script allowing to handle upload of files to your server:
Code:

<cfprocessingdirective pageEncoding="utf-8">
<!---This variable specifies relative path to the folder, where the gallery with uploaded files is located.
Do not forget about the slash in the end of the folder name.--->
<cfset galleryPath="Gallery/" />
<cfset absGalleryPath="#ExpandPath(galleryPath)#" />
<!---Get total number of uploaded files (all files are uploaded in a single package) and
iterate through uploaded data and save the original file, thumbnail, and description.--->
<cfset fileCount=(#Form.PackageFileCount#-1)>
<cfloop index="i" from="0" to="#fileCount#">
	<!--- Save converted files --->
	<cfloop index="j" from="0" to="1">
		<cffile action="UPLOAD" filefield="File#j#_#i#" 
			destination="#absGalleryPath#" 
			nameconflict="MakeUnique">
	</cfloop>	
</cfloop>

The complete ColdFusion sample application is located in the attachment of this post. Please download, and try it out.

Edited by moderator Friday, January 28, 2011 11:47:56 AM(UTC)  | Reason: Not specified

File Attachment(s):
iu7_coldfusion.zip (2,406kb) downloaded 38 time(s).
Best regards,
Dmitry Obukhov
Technical Support. Aurigma, Inc.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.