For the love of pete I can't get it to accept any variables into to my SQL db. If I put static info it works. I can't seem to pass any paramaters over with scriptdata and it makes it more challenging because I'm using smarty template system on top.
I was trying to do this.
{literal}
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#fileUpload").uploadify({
'scriptData' :{'alb_id': '{/literal}$alb_id{literal}','mem_id': '{/literal}$info.mem_id{literal}'},
'uploader': '/ajax/upload/uploadify.swf',
'cancelImg': '/ajax/upload/cancel.png',
'script': '/ajax/upload/uploader.php',
'folder': 'photos',
'multi': true,
'displayData': 'speed',
'fileDesc' : 'Image Files',
'fileExt': '*.jpg;*.jpeg;',
'simUploadLimit': 200,
'width' : 130,
'queueID' : 'fileQueue',
'buttonImg': '/themes/mytheme/gfx/buttons/but_browse.gif'
});
});
</script>
{/literal}
In my template file. The upload part works fine. Just not the mysql. I am using a function built into the script to resize images for thumbnailes and what not and build a directory. All that works. It just won't pass any variables to the db.
include_once("../../includes/config/config.inc.php");
//load libraries
include(DOC_ROOT."/libraries.php");
$conn = mysql_connect(SQL_HOST, SQL_USER, SQL_PASS,1);
mysql_select_db(SQL_DB,$conn);
$alb_id = $_REQUEST['alb_id'];
$mem_id = $_REQUEST['mem_id'];
if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name'];
$extension = ".jpeg";
$photo = build_thumbnailes($tempFile,$extension);
$sql ="INSERT INTO `photos`(`mem_id`, `photo`, `photo_med`, `photo_small`, `approved`,`posted`, `upload_date`)
VALUES
('$alb_id', '".$photo["ex"]."', '".$photo["med"]."','".$photo["small"]."' , '1', time(), time())";
mysql_query($sql) or die(mysql_error());
Please help if you can. I'm going crazy with this thing. Thanks.