Reference content is as follows: /* CKEditor_upload.php Monkee
*/ $ Config = array (); $ Config ['type'] = array ("flash", "img"); // upload the allowed type value $ Config ['IMG '] = array ("jpg", "bmp", "gif"); // img allows suffixes $ Config ['Flash'] = array ("flv", "swf"); // flash allows suffixes $ Config ['flash _ size'] = 200; // The maximum size of the uploaded flash is KB. $ Config ['IMG _ size'] = 500; // The maximum size of uploaded img is KB. $ Config ['message'] = "uploaded successfully"; // The message displayed after the upload is successful. if it is null, the message is not displayed. $ Config ['name'] = mktime (); // the uploaded file naming rules are named in unix timestamps. $ Config ['flash _ dir'] = "/ckeditor/upload/flash"; // upload The flash file address with an absolute address to facilitate upload. "/" is not added after the php file is placed in any location on the site "/" $ Config ['IMG _ dir'] = "/ckeditor/upload/img"; // upload the imgfile address with an absolute address and an absolute address to facilitate upload. "/" is not added after the php file is placed in any location on the site "/" $ Config ['site _ url'] = ""; // The website address. this parameter is related to the image upload address. "/" is left blank. // File Upload Uploadfile (); Function uploadfile () { Global $ config; // Determine whether the call is illegal If (empty ($ _ GET ['ckeditorfuncnum']) Mkhtml (1, "", "incorrect function call request "); $ Fn = $ _ GET ['ckeditorfuncnum']; If (! In_array ($ _ GET ['type'], $ config ['type']) Mkhtml (1, "", "incorrect file call request "); $ Type = $ _ GET ['type']; If (is_uploaded_file ($ _ FILES ['upload'] ['tmp _ name']) { // Determine whether a file is allowed to be uploaded $ Filearr = pathinfo ($ _ FILES ['upload'] ['name']); $ Filetype = $ filearr ["extension"]; If (! In_array ($ filetype, $ config [$ type]) Mkhtml ($ fn, "", "incorrect file type! "); // Determine whether the file size meets the requirements If ($ _ FILES ['upload'] ['size']> $ config [$ type. "_ size"] * 1024) Mkhtml ($ fn, "", "the uploaded file cannot exceed". $ config [$ type. "_ size"]. "KB! "); // $ Filearr = explode (".", $ _ FILES ['upload'] ['name']); // $ Filetype = $ filearr [count ($ filearr)-1]; $ File_abso = $ config [$ type. "_ dir"]. "/". $ config ['name']. ".". $ filetype; $ File_host = $ _ SERVER ['document _ root']. $ file_abso;
If (move_uploaded_file ($ _ FILES ['upload'] ['tmp _ name'], $ file_host )) { Mkhtml ($ fn, $ config ['site _ url']. $ file_abso, $ config ['message']); } Else { Mkhtml ($ fn, "", "file Upload failed. Please check the upload directory settings and directory read/write permissions "); } } } // Output js call Function mkhtml ($ fn, $ fileurl, $ message) { $ Str =' |