Open myusufid opened 4 years ago
In the view tha contain TinyMCE includes the code below:
@include('mceImageUpload::upload_form', ['upload_url' => 'url for the method responsible for upload'])
You can copy the method uploadImage from Petehouston\Tinymce\TinymceController
reponsable for upload, inside the controller defined in the 'upload_url' value above:
public function uploadImage(Request $request)
{
$image = $request->file('image');
$filename = 'image_'.time().'_'.$image->hashName();
$image = $image->move(public_path('YOUR_FOLDER_NAME_OR_PATH_HERE'), $filename);
return $this->mce_back($filename);
}
Add the mce_back
method in the same file(controller) above:
function mce_back($filename)
{
return ("
<script>
top.$('.mce-btn.mce-open').parent().find('.mce-textbox').val('/YOUR_FOLDER_NAME_OR_PATH_HERE/".$filename."').closest('.mce-window').find('.mce-primary').click();
</script>
");
}
hi im very love with your package, work with charm can you tell me how to change the upload directory? by default is
public / img
i want something else, i have tried changing the directory with my controller but in textarea tinymce its failed to load the image file