<?php
require(dirname(__FILE__) . '/includes/simple-ajax-uploader/extras/Uploader.php');

// Directory where we're storing uploaded images
// Remember to set correct permissions or it won't work
$upload_dir = dirname(__FILE__) . '/../custom/images/menu-boards/';

$uploader = new FileUpload('uploadfile');

// Handle the upload
$result = $uploader->handleUpload($upload_dir);

if (!$result) {
  exit(json_encode(array('success' => false, 'msg' => $uploader->getErrorMsg())));  
}

echo json_encode(array('success' => true, 'file' => $uploader->getFileName()));
