Jump to content

uploadify


deansaddigh

Recommended Posts

trying to get uploadify to then save details to db

Can anone give me some pointers at all please cause i am stumped.

 

heres the 2 relevant pieces of  code on the add photos page.

 

<link href="uploadify/uploadify.css" rel="stylesheet" type="text/css" media="screen" />
<script type="text/javascript" src="uploadify/jquery-1.3.2.min.js" ></script>
<script type="text/javascript" src="uploadify/swfobject.js"></script>
<script type="text/javascript" src="uploadify/jquery.uploadify.v2.1.0.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {

$("#fileInput2").uploadify({
	'uploader'       : 'uploadify/uploadify.swf',
	'script'         : 'uploadify/uploadify_student_photos.php',
	'cancelImg'      : 'uploadify/cancel.png',
	'folder'         : '../studentimages',
	'multi'          : true
});
});
</script>

<p> <strong>Select accreditation logos To upload</strong></p>
<input id="fileInput2" name="fileInput2" type="file" /> <a href="javascript:$('#fileInput2').uploadifyUpload();">Upload Files</a> | <a href="javascript:$('#fileInput2').uploadifyClearQueue();">Clear Queue</a></div>
         

 

The proccessing page where im just trying to get it to write to the db  thats why i have specifiacally put some strings in the insert code.

 

as of yet its not putting anything in the db

<?php include("includes/connection.php"); ?>
<?php include "securitycheck.php";?>
<?php
/*
Uploadify v2.1.0
Release Date: August 24, 2009
*/

if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
$targetFile =  str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];

// $fileTypes  = str_replace('*.','',$_REQUEST['fileext']);
// $fileTypes  = str_replace(';','|',$fileTypes);
// $typesArray = split('\|',$fileTypes);
// $fileParts  = pathinfo($_FILES['Filedata']['name']);

// if (in_array($fileParts['extension'],$typesArray)) {
	// Uncomment the following line if you want to make the directory if it doesn't exist
	// mkdir(str_replace('//','/',$targetPath), 0755, true);

	move_uploaded_file($tempFile,$targetFile);
	echo "1";
// } else {
// 	echo 'Invalid file type.';
// }

//Store the filename, path other criteria in the database 
	$query = "INSERT INTO studentphotos(image_id, name, path)
	VALUES(0, '3', '5')";

	//Perform the query
	$add = mysql_query($query, $conn)
		or die("Unable to add the image details to the database");
}
?>

 

Kind Regards

 

Dean

Link to comment
https://forums.phpfreaks.com/topic/212681-uploadify/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.