I Call my PHP into my javascript code, may I know why $_GET
not working in my PHP file?
My URL is : localhost/img/index.php?fname=johndoe
Javascript inside my index.php is :
<script src="uploadname.js"></script>
<script type="text/javascript">
$(document).ready(
function()
{
$(\'#redactor_content\').redactor({
imageUpload: \'uploadimage.php\',
minHeight: 200 // pixels
});
}
);
</script>
php file uploadimage.php
<?php
$fname=$_GET['fname'];
$dir = '../assets/uploads/r/';
$sysUrl = lc('sysUrl');
$_FILES['file']['type'] = strtolower($_FILES['file']['type']);
if ($_FILES['file']['type'] == 'image/png'
|| $_FILES['file']['type'] == 'image/jpg'
|| $_FILES['file']['type'] == 'image/gif'
|| $_FILES['file']['type'] == 'image/jpeg'
|| $_FILES['file']['type'] == 'image/pjpeg')
{
// setting file's mysterious name
$filename = $fname.date('YmdHis').'.jpg';
$file = $dir.$filename;
// copying
copy($_FILES['file']['tmp_name'], $file);
// displaying file
$array = array(
'filelink' => $sysUrl.'/assets/uploads/r/'.$filename
);
echo stripslashes(json_encode($array));
}
?>
I've used above code but when I save the file it shows blank. got nothing may I know the reason why?