Redactor(富文本编辑器)照片上传 [英] Redactor ( Rich text Editor ) photo upload
本文介绍了Redactor(富文本编辑器)照片上传的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,我正在尝试完成我的申请。我被Redactor的照片上传者困住了。我使用的是asp.net以下是redactor的用法:
< script type = text / javascript >
$(function(){
$('#redactor_content')。redactor({
focus:true,
imageUpload:'.. / redactor / PHP / image_upload.php'
});
});
< / script >
image_upload.php
< html >
< head >
< title >
< / title < span class =code-keyword>>
< / head >
< body >
<? php
// 此 a 简化 示例, 封面 security 已上传 images。
// 此 示例 只是 演示 t他 logic 背后 process。
// files storage 文件夹
$ dir =' ../ redactor / IMAGES /' ;
$ _ FILES ['file'] ['type'] = strtolower($ _ FILES [' file'] ['type']);
if ($ _ FILES ['file'] ['type'] = = 'image / png'
|| $ _ FILES ['file'] ['type'] = = 'image / jpg'
|| $ _ FILES ['file'] ['type'] = = 'image / gif'
|| $ _ FILES ['file'] ['type'] = = 'image / jpeg'
|| $ _ FILES ['file'] ['type'] = = 'image / pjpeg')
{
// 设置 file's mysterious 名称
$ filename = md5(date(' YmdHis')) .'jpg';
$ file = $ DIR $文件名。
// 复制
< span class =code-summarycomment> move_uploaded_file($ _ FILES ['file'] ['tmp_name'], $ file);
// 显示 file
$ array = < span class =code-keyword> array(
<跨度class =code-summarycomment> filelink = > 'http://redactor8/tmp/'.$filename
);
echo stripslashes(json_encode($ array));
}
?>
< / body >
< / html >
解决方案
(function(){
< blockquote>('#redactor_content')。redactor({
focus:true,
imageUpload:'.. / redactor / PHP / image_upload.php'
});
});
< / script >
image_upload.php
< html >
< head >
< title >
< / title < span class =code-keyword>>
< / head >
< body >
<? php
// 此 a 简化 示例, 封面 security 已上传 images。
// 此 示例 只是 演示 t他 logic 背后 process。
// files storage 文件夹
dir
=' ../ redactor / IMAGES /' ;
< span class =code-summarycomment>
Hello , I am trying to finish my application. I am stuck with the photo uploader of Redactor. i am using asp.net Here is the usage of redactor :
<script type="text/javascript">
$(function() {
$('#redactor_content').redactor({
focus: true,
imageUpload: '../redactor/PHP/image_upload.php'
});
});
</script>
image_upload.php
<html>
<head>
<title>
</title>
</head>
<body>
<?php
// This is a simplified example, which doesn't cover security of uploaded images.
// This example just demonstrate the logic behind the process.
// files storage folder
$dir = '../redactor/IMAGES/';
$_FILES['file']['type'] = strtolower($_FILES['file']['type']);
if ($_FILES['file']['type'] == 'image/png'
|| $_FILES['file']['type'] == 'image/jpg'
|| $_FILES['file']['type'] == 'image/gif'
|| $_FILES['file']['type'] == 'image/jpeg'
|| $_FILES['file']['type'] == 'image/pjpeg')
{
// setting file's mysterious name
$filename = md5(date('YmdHis')).'.jpg';
$file = $dir.$filename;
// copying
move_uploaded_file($_FILES['file']['tmp_name'], $file);
// displaying file
$array = array(
'filelink' => 'http://redactor8/tmp/'.$filename
);
echo stripslashes(json_encode($array));
}
?>
</body>
</html>
解决方案 (function() {
('#redactor_content').redactor({
focus: true,
imageUpload: '../redactor/PHP/image_upload.php'
});
});
</script>
image_upload.php
<html>
<head>
<title>
</title>
</head>
<body>
<?php
// This is a simplified example, which doesn't cover security of uploaded images.
// This example just demonstrate the logic behind the process.
// files storage folder
dir
= '../redactor/IMAGES/';
这篇关于Redactor(富文本编辑器)照片上传的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文