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

Notification

Icon
Error

Options
Go to last post Go to first unread
agulaid  
#1 Posted : Saturday, June 28, 2008 1:37:56 AM(UTC)
agulaid

Rank: Newbie

Groups: Member
Joined: 6/28/2008(UTC)
Posts: 2

Im testing Aurigma before purchasing the product, but cannot get it to work on my local Vista machine running XAMPP. The file upload doesnt throw any errors, i get the success alert but cannot see the uploaded images anywhere.

I get redirected to the gallery page but cannot see the image, all i see is the image name and the hyperlink.

Folder structure is as follows:

Website running on:
//LOCALHOST/

Gallery Folder on:
//LOCALHOST/Gallery/ ---Editor rights assigned to folder for everyone including IUSER.

Thumbnail Folder on:
//LOCALHOST/Gallery/Thumbnails/ -- Editor rights assigned to folder for everyone including IUSER.



//LOCALHOST/Index.php:
Code:
<!--BEGIN-->
<!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>
	<title>Aurigma Image Uploader - Basic Demo</title>

	<script type="text/javascript" src="/ImageUploaderNoSetup/iuembed.js"></script>

	<link href="style01.css" type="text/css" rel="stylesheet" />
</head>
<body>
	<p>
		This simple application is a quick start demo with minimum settings. It demonstrates
		how to:
	</p>
	<ul>
		<li>Display thumbnails in two-pane layout.</li>
		<li>Upload the file with 120x120 thumbnail.</li>
		<li>Redirect to another page after successful upload.</li>
	</ul>
	<fieldset>
		<legend>Note</legend>This demo application <strong>deletes all previously uploaded files</strong>.
		Keep in mind that it is a feature of this demo, not of Image Uploader itself. If
		you <strong>do not want to delete uploaded files</strong>, you should modify the
		upload processing page specified by the <strong>Action</strong> parameter.
	</fieldset>

	<script type="text/javascript">
//<![CDATA[
//Create JavaScript object that will embed Image Uploader to the page.
var iu = new ImageUploaderWriter("ImageUploader1", 650, 400);

//For ActiveX control full path to CAB file (including file name) should be specified.
iu.activeXControlCodeBase = "/ImageUploaderNoSetup/ImageUploader5.cab";
iu.activeXControlVersion = "5,1,10,0";

//For Java applet only path to directory with JAR files should be specified (without file name).
iu.javaAppletJarFileName = "/ImageUploaderNoSetup/ImageUploader5.jar";
iu.javaAppletCodeBase = "/ImageUploaderNoSetup/";
iu.javaAppletCached = true;
iu.javaAppletVersion = "5.1.10.0";

iu.showNonemptyResponse = "off";

//Configure appearance.
iu.addParam("PaneLayout", "TwoPanes");
iu.addParam("ShowDebugWindow", "true");
iu.addParam("AllowRotate", "false");
iu.addParam("BackgroundColor", "#ccccff");

//Configure License Keys
iu.addParam("LicenseKey", "71050-4338A-00000-09EC4-D2986;72050-4338A-00000-08333-86099");

//Configure thumbnail settings.
iu.addParam("UploadThumbnail1FitMode", "Fit");
iu.addParam("UploadThumbnail1Width", "120");
iu.addParam("UploadThumbnail1Height", "120");
iu.addParam("UploadThumbnail1JpegQuality", "60");

//Configure URL files are uploaded to.
iu.addParam("Action", "upload.php")

//Configure URL where to redirect after upload.
iu.addParam("RedirectUrl", "gallery.php")

//Tell Image Uploader writer object to generate all necessary HTML code to embed 
//Image Uploader to the page.
iu.writeHtml();
//]]>
	</script>

</body>
</html>
<!--END-->


//LOCALHOST/upload.php



Code:
<?php
//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.
$galleryPath = "../Gallery/";

$absGalleryPath = realpath($galleryPath) . "/";
$absThumbnailsPath = realpath($galleryPath . "Thumbnails/") . "/";

function saveUploadedFiles()
{
	global $absGalleryPath, $absThumbnailsPath;
	
	//First of all, clear files and data uploaded at previous time.
	
	//Delete source files.
	$handle = opendir($absGalleryPath);

	while (false !== ($file = readdir($handle)))
	{
		if (is_file($absGalleryPath . $file))
		{
			unlink($absGalleryPath . $file);
		}
	}
	closedir($handle); 

	//Delete thumbnails
	$handle = opendir($absThumbnailsPath);	
	while (false !== ($file = readdir($handle))) 
	{
		if (is_file($absThumbnailsPath . $file))
		{
			unlink($absThumbnailsPath . $file);
		}
	}
	closedir($handle);

	//NOTE: If you do not want to delete previously uploaded files, just 
	//remove or comment out the code above.
	
	//Create XML file which will keep information about files (image dimensions, description, etc). 
	//XML is used solely for brevity. In real-life application most likely you will use database instead.
	$descriptions = new DOMDocument('1.0');
	$descriptions->appendChild($descriptions->createElement("files"));
	
	//Get total number of uploaded files (all files are uploaded in a single package).
	$fileCount = $_POST ["FileCount"];
	
	//Iterate through uploaded data and save the original file, thumbnail, and description.
	for ($i = 1; $i <= $fileCount; $i++)
	{
		//Get source file and save it to disk.
		$sourceFileField = "SourceFile_" . $i;
		if (!$_FILES[$sourceFileField]['size'])
		{
			return;	
		}
		$fileName = getSafeFileName($_FILES[$sourceFileField]['name']);
		move_uploaded_file($_FILES[$sourceFileField]['tmp_name'], $absGalleryPath . "/" . $fileName);

		//Get first thumbnail (the single thumbnail in this code sample) and save it to disk.
		$thumbnail1Field = "Thumbnail1_" . $i;
		if (!$_FILES[$thumbnail1Field]['size'])
		{
			return;	
		}
		move_uploaded_file($_FILES[$thumbnail1Field]['tmp_name'], $absGalleryPath . "/Thumbnails/" . $fileName . ".jpg");

		//Save file info.
		$xmlFile = $descriptions->createElement("file");
		$xmlFile->setAttribute("name", $fileName);
		$xmlFile->setAttribute("width", $_POST ['Width_' . $i]);
		$xmlFile->setAttribute("height", $_POST ['Height_' . $i]);
		$xmlFile->setAttribute("description", $_POST ['Description_' . $i]);
		$descriptions->documentElement->appendChild($xmlFile);
	}

	$descriptions->save($absGalleryPath . "Descriptions.xml");
}

//This method verifies whether file with such name already exists 
//and if so, construct safe filename name (to avoid collision).	
function getSafeFileName($fileName)
{
	global $absGalleryPath;
	
	$newFileName = $fileName;
	$j = 1;
	while (file_exists($absGalleryPath . "/" . $newFileName))
	{
		$newFileName = $j . "_" . $fileName;
		$j = $j + 1;
	}
	return $newFileName;	
}

saveUploadedFiles();
?>



Any help in resolving this would be much appreciated. Pray
Eugene Kosmin  
#2 Posted : Sunday, June 29, 2008 4:06:37 PM(UTC)
Eugene Kosmin

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 9/19/2006(UTC)
Posts: 455

Was thanked: 27 time(s) in 27 post(s)
Hi,

I've tested you code and it works fine. Try to set editor rights to entire XAMPP directory and make sure that you are using PHP 5. Our samples don't work with PHP 4.
Best regards,
Eugene Kosmin.
Aurigma Development Team
Users browsing this topic
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.