It looks like you're new here. If you want to get involved, click one of these buttons!
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Uploadify scriptData Sample</title>
<link rel="stylesheet" href="fileupload/css/uploadify.css" type="text/css" />
<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="js/jquery.uploadify.js"></script>
<script type="text/javascript" charset="utf-8">
var sessionId = "<?php echo session_id(); ?>";
</script>
<script type="text/javascript">
$(document).ready(function() {
$("#fileUpload").fileUpload({
'uploader': 'uploader.swf',
'cancelImg': 'cancel.png',
'method' :'post';
'script': 'upload1.php',
'scriptData', {'sessionId': sessionId},
'fileDesc': 'Image Files',
'method': 'post',
'fileExt': '*.jpg;*.jpeg',
'multi': false,
'buttonText': 'browse',
'displayData': 'speed',
'onComplete' : function(){
location.reload(true);
},
'onError' : function(){ alert('error');}
});
});
</script>
</head>
<body>
<fieldset style="border: 1px solid #CDCDCD; padding: 8px; padding-bottom:0px; margin: 8px 0">
<legend><strong>add photo</strong></legend>
<div id="fileUpload">problem with javascript</div>
<a href="javascript:$('#fileUpload').fileUploadStart()">OK</a></li>
<a href="javascript:$('#fileUpload').fileUploadClearQueue()">clean</a></li>
</body>
</html>
<? session_id($_POST['sessionId']);
session_start();
$user=$_SESSION['User_Authorization'];
if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_GET['folder'] . '/';
$targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
// 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);
$query= mysql_query("insert into avatar (`id`,`user_id`,`photo`) Values ('','$user','$targetFile')");