Description
hi,
untill now i did my uploads the usual way with php/html in one page after recalling/reloading it with the button.
now i got uploadify.com installed but don't get my echo and header-redirection.. guess i just need a jquery expert to help me with this and other stuff..
thanks,
robert
<?php
if (!empty($_FILES)) {
echo "x " . $_FILES;
echo $_FILES['Filedata']['tmp_name'];
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
$targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
echo $_FILES['Filedata']['name'];
move_uploaded_file($tempFile,$targetFile);
echo str_replace($_SERVER['DOCUMENT_ROOT'],'',$targetFile);
}
?>
<link href="/uploadify/uploadify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="/uploadify/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="/uploadify/swfobject.js"></script>
<script type="text/javascript" src="/uploadify/jquery.uploadify.v2.1.4.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#file_upload').uploadify({
'uploader' : '/uploadify/uploadify.swf',
'script' : 'uploadify.php',
'cancelImg' : '/uploadify/cancel.png',
'folder' : '/uploads',
//'sizeLimit' : '4390000',
'buttonText' : 'Search',
'fileExt' : '*.jpg;*.gif;*.png',
'fileDesc' : 'Image Files (.JPG, .GIF, .PNG)',
'auto' : true,
onComplete : function (evt, queueID, fileObj, response, data) {
$('#imgContainerDiv').append('<img src="uploads/'+fileObj.name+'" alt="'+fileObj.name+'"/>');
window.location.href="uploadify.php";
}
});
});
</script>
<div id="imgContainerDiv">
<input id="file_upload" name="file_upload" type="file" />
</div>