玛氪宕·梦魔(Markdown Memo),使用Markdown的云端备忘录,百度IFE的RIA启航班的不合格的作业,才……才没有什么阴谋呢!
源gitee链接https://gitee.com/arathi/MarkdownMemo?_from=gitee_search
				
			
			
		
			You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
			
				
					54 lines
				
				1.8 KiB
			
		
		
			
		
	
	
					54 lines
				
				1.8 KiB
			| 
											11 years ago
										 | <?php | ||
|  | 
 | ||
|  | 	/* | ||
|  | 	 * PHP cross-domain upload demo for Editor.md | ||
|  |      * | ||
|  |      * @FileName: upload.php | ||
|  |      * @Auther: Pandao | ||
|  |      * @E-mail: pandao@vip.qq.com | ||
|  |      * @CreateTime: 2015-02-15 19:12:11   | ||
|  |      * @UpdateTime: 2015-02-15 20:47:52   | ||
|  |      * Copyright@2015 Editor.md all right reserved. | ||
|  | 	 */ | ||
|  | 
 | ||
|  |     header("Content-Type:text/html; charset=utf-8"); | ||
|  |     header("Access-Control-Allow-Origin: *"); | ||
|  | 
 | ||
|  |     require("editormd.uploader.class.php"); | ||
|  | 
 | ||
|  |     error_reporting(E_ALL & ~E_NOTICE); | ||
|  | 	 | ||
|  | 	$path     = __DIR__ . DIRECTORY_SEPARATOR; | ||
|  | 	$url      = dirname($_SERVER['PHP_SELF']) . '/'; | ||
|  | 	$savePath = realpath($path . '../uploads/') . DIRECTORY_SEPARATOR; | ||
|  | 	$saveURL  = '//'. $_SERVER['SERVER_NAME'] . $url . '../uploads/';   // 本例是演示跨域上传所以加上$_SERVER['SERVER_NAME'] | ||
|  |      | ||
|  |     /*echo "<pre>"; | ||
|  |     print_r($_SERVER); | ||
|  |     echo $saveURL; | ||
|  |     echo "</pre>";*/ | ||
|  | 
 | ||
|  | 	$formats  = array(		 | ||
|  | 		'image' => array('gif', 'jpg', 'jpeg', 'png', 'bmp', 'webp') | ||
|  | 	); | ||
|  | 
 | ||
|  |     $name = 'editormd-image-file'; // file input name | ||
|  | 
 | ||
|  |     if (isset($_FILES[$name])) | ||
|  |     {         | ||
|  |         $imageUploader = new EditorMdUploader($savePath, $saveURL, $formats['image'], false);  // Ymdhis表示按日期生成文件名,利用date()函数 | ||
|  |          | ||
|  |         $imageUploader->config(array( | ||
|  |             'maxSize' => 1024,        // 允许上传的最大文件大小,以KB为单位,默认值为1024 | ||
|  |             'cover'   => true         // 是否覆盖同名文件,默认为true | ||
|  |         )); | ||
|  |          | ||
|  |         $imageUploader->redirect    = true; | ||
|  |         $imageUploader->redirectURL = $_GET['callback'] . '?dialog_id=' . $_GET['dialog_id'] . '&temp=' . date('ymdhis'); | ||
|  |          | ||
|  |         if ($imageUploader->upload($name)) | ||
|  |         { | ||
|  |             $imageUploader->message('上传成功!', 1); | ||
|  |         } | ||
|  |     } | ||
|  | ?> |