Get KoolPHP UI with 30% OFF!

Error with kooluploader

Luis
I'm getting this error: Warning: json_encode() expects exactly 1 parameter, 2 given in C:\AppServ\www\MTPS\privado\KoolControls\KoolUploader\kooluploader.php on line 1
My file is the same that your example (please see below the PHP Page and Handle.php, thank you for your support.
PHP Page
<?php
/*
* This file is ready to run as standalone example. However, please do:
* 1. Add tags <html><head><body> to make a complete page
* 2. Change relative path in $KoolControlFolder variable to correctly point to KoolControls folder
*/

$KoolControlsFolder = "KoolControls"; //Relative path to "KoolPHPSuite/KoolControls" folder
require $KoolControlsFolder."/KoolUploader/kooluploader.php";
require $KoolControlsFolder."/KoolAjax/koolajax.php";

$kul = new KoolUploader("kul");
$kul->scriptFolder = $KoolControlsFolder."/KoolUploader";
$kul->handlePage = "handle.php";
$kul->allowedExtension = "txt,jpg,gif,doc,pdf";
$kul->maxFileSize = 512*1024; //500KB
$kul->progressTracking = true;

$style_select = "default";

if(isset($_POST["style_select"]))
{
$style_select = $_POST["style_select"];
}
$kul->styleFolder=$KoolControlsFolder."/KoolUploader/styles/$style_select";

?>

<form id="form1" method="post">
<?php echo $koolajax->Render();?>
<div style="padding-left:10px;">
Select style:
<select id="style_select" name="style_select" onchange="submit();">
<option value="default" <?php if ($style_select=="default") echo "selected" ?> >Default</option>
<option value="black" <?php if ($style_select=="black") echo "selected" ?> >Black</option>
<option value="hay" <?php if ($style_select=="hay") echo "selected" ?> >Hay</option>
<option value="silver" <?php if ($style_select=="silver") echo "selected" ?> >Silver</option>
<option value="inox" <?php if ($style_select=="inox") echo "selected" ?> >Inox</option>
<option value="office2007" <?php if ($style_select=="office2007") echo "selected" ?> >Office2007</option>
<option value="outlook" <?php if ($style_select=="outlook") echo "selected" ?> >Outlook</option>
<option value="vista" <?php if ($style_select=="vista") echo "selected" ?> >Vista</option>
</select>
</div>

<div style="padding:10px;">
<?php echo $kul->Render();?>
</div>
<div style="padding-top:20px;">
<i>*Note:</i> Please test uploading with *.txt, *.doc, *.pdf, *.jpg, *.gif ( size &lt; 500KB )
</div>

</form>
Handle.php
<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
// always modified
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
// HTTP/1.1
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
// HTTP/1.0
header("Pragma: no-cache");

$KoolControlsFolder = "KoolControls";
require $KoolControlsFolder."/KoolUploader/kooluploader.php";

//Create handle object and edit upload settings.
$kulhandle = new KoolUploadHandler();
$kulhandle->targetFolder = "Files";
//Call the handle function to handle the request from client
echo $kulhandle->handleUpload();
?>
Posted Aug 26, 2015 Kool
David
Hi Luis,
It appears that you have an old version of PHP. Is there any chance for you to upgrade PHP to any version > 5.3, which would solve this warning?
Rgds,
Posted Aug 27, 2015 Kool -
Luis
You were right, that was one of the problems, but now I can select the file, but it doesn't upload it, the directory "Files" ( $column->targetFolder = "Files"; ) exists, any idea?
Posted Aug 27, 2015 Kool
David
Hi Luis,
I think you could add the following line:
$kulhandle->allowedExtension = "txt,jpg,gif,doc,pdf";

It's because the uploader can only check file type on client-side which is easy for any user to mess with using javascript. So the handle page must also check the file type on server for security reason.
Rgds,
Posted Aug 28, 2015 Kool -