tupali_fork/upload/Simple-Ajax-Uploader-master/examples/basic_example/file_upload.php

18 lines
464 B
PHP
Raw Normal View History

<?php
require(dirname(__FILE__) . '/../../extras/Uploader.php');
// Directory where we're storing uploaded images
// Remember to set correct permissions or it won't work
$upload_dir = 'upload_files/';
$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));