gdidc/webedit_org/photo_uploader/popup/php/index.php
2022-08-15 12:17:25 +09:00

49 lines
1.2 KiB
PHP

<?php
/*
* jQuery File Upload Plugin PHP Example 5.14
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2010, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/MIT
*/
@include_once("./JSON.php");
if( !function_exists('json_encode') ) {
function json_encode($data) {
$json = new Services_JSON();
return( $json->encode($data) );
}
}
@ini_set('gd.jpeg_ignore_warning', 1);
$ym = date('ym');
$data_dir = $_SERVER[DOCUMENT_ROOT] . "/uploaded/webedit/".$ym."/";
$data_url = "/uploaded/webedit/".$ym."/";
@mkdir($data_dir, 0777);
@chmod($data_dir, 0777);
$is_editor_upload = true;
if( $is_editor_upload ) {
@require('UploadHandler.php');
$options = array(
'upload_dir' => $data_dir,
'upload_url' => $data_url,
// This option will disable creating thumbnail images and will not create that extra folder.
// However, due to this, the images preview will not be displayed after upload
'image_versions' => array()
);
$upload_handler = new UploadHandler($options);
} else {
echo json_encode(array('files'=>array('0'=>array('error'=>'정상적인 업로드가 아닙니다.'))));
exit;
}