Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. public function upload(Request $request)
  2. {
  3. //return "xxx";
  4. $CKEditor = $request->input('CKEditor');
  5. $funcNum = $request->input('CKEditorFuncNum');
  6. $message = $url = '';
  7. if (Input::hasFile('upload')) {
  8. //return "working";
  9. $file = Input::file('upload');
  10. if ($file->isValid()) {
  11. $filename = rand(1000, 9999) . $file->getClientOriginalName();
  12. $file->move(public_path() . '/wysiwyg/', $filename);
  13. $url = url('wysiwyg/' . $filename);
  14. } else {
  15. $message = 'An error occurred while uploading the file.';
  16. }
  17. } else {
  18. $message = 'No file uploaded.';
  19. }
  20. return '<script>window.parent.CKEDITOR.tools.callFunction(' . $funcNum . ', "' . $url . '", "' . $message . '")</script>';
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement