无法在summernote上传图片

时间:2017-10-24 10:42:16

标签: php mysql summernote

我在mysql中创建了表

                ServerPath = "Data Source=" + myDr["server1"].ToString();
                ServerPath += ";Initial Catalog=" + myDr["catalog1"].ToString();
                ServerPath += ";uid=" + myDr["username"].ToString();
                ServerPath += ";pwd=" + myDr["password1"].ToString();
                ServerPath += ";Connect Timeout=" + TimeOuted.ToString();



 conn1.ConnectionString = ServerPath;

当然我在本地所有文件下载了链接! 下载summernote代码并放入服务器文件夹

我在根网站服务器文件夹名称图像中创建

和文件夹CREATE TABLE IF NOT EXISTS `post` ( `idpost` int(11) NOT NULL, `dataorapost` datetime NOT NULL, `idautore` int(11) NOT NULL, `idgruppo` int(11) NOT NULL, `idargomento` int(11) NOT NULL, `titolopost` varchar(40) NOT NULL, `testopost` text NOT NULL ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;

创建带头部的页面后

assets/images

在体内插入一个:

<!-- Latest compiled and minified CSS LOCAL -->
<link rel="stylesheet" href="css/bootstrap.min.css" >
<link rel="stylesheet" href="css/bootstrap.css" >

<!--summernote locale -->
<script src="summernote/jquery.js"></script> 
<script src="summernote/bootstrap.js"></script>

<link rel="stylesheet" href="summernote/summernote.css" >
<script src="summernote/summernote.js"></script>
<script src="lang/summernote-it-IT.js"></script>

并在页面uploader.php我写了

<form   action="savepost.php" enctype="multipart/form-data"  method="post" name="modulo" id="modulo" >
    <div class="container">
        <div class="row">
            <div class="col-sm-12">
                <div class="form-group">

                    <label for="datapost" >Data post</label>
                    <div class="input-group">
                        <span class="input-group-addon"><i class="glyphicon glyphicon-calendar" aria-hidden="true"></i></span>
                        <input type="text" class="form-control" name="dataorapostita" id="dataorapostita"  readonly="readonly"  value="<?php echo $dataorapostita; ?>"/>
                        <input type="Hidden" class="form-control" name="dataorapost" id="dataorapost"  readonly="readonly"  value="<?php echo $dataorapost; ?>"/>   
                    </div>

                    <label for="nomeautore">Nome autore</label>
                    <div class="input-group">
                        <span class="input-group-addon"><i class="glyphicon glyphicon-user" aria-hidden="true"></i></span>
                        <input type="hidden"  class="form-control " name="idautore" id="idautore"   value="<?php echo $idautore; ?>">
                        <input type="text"  class="form-control " name="nomeautore" id="nomeautore" readonly="readonly" value="<?php echo $nomeautore; ?>">
                    </div>
                </div>
                <label for="name" >Argomento post</label>
                <div class="input-group">
                    <span class="input-group-addon"><i class="glyphicon glyphicon-flag" aria-hidden="true"></i></span>
                    <select class="input-sm" name="idargomento" id="idargomento">
                        <option value=""   >SELEZIONA</option>
                        <optgroup label="Weblabeling">
                            <option value="1">Weblabeling</option>
                            <option value="2">ActiveX</option>
                            <option value="3">Stampanti</option>
                        </optgroup>
                        <optgroup label="Webservice">
                            <option value="11">Webservice</option>
                        </optgroup>
                    </select>
                </div>

                <script>
                    ////lang: 'it-IT', // default: 'en-US'
                    $(document).ready(function () {
                        $('#summernote').summernote({
                            height: 200,
                            onImageUpload: function (files, editor, welEditable) {
                                sendFile(files[0], editor, welEditable);
                            }
                        });
                        function sendFile(file, editor, welEditable) {
                            data = new FormData();
                            data.append("file", file);
                            $.ajax({
                                data: data,
                                type: "POST",
                                url: "Your URL POST (php)",
                                cache: false,
                                contentType: false,
                                processData: false,
                                success: function (url) {
                                    editor.insertImage(welEditable, url);
                                }
                            });
                        }
                    });

                </script>

                <label for="nomeautore">Titolo post</label>
                <div class="input-group">
                    <span class="input-group-addon"><i class="glyphicon glyphicon-pencil" aria-hidden="true"></i></span>
                    <input type="text"  class="form-control " name="titolopost" id="titolopost"     >
                </div>

                <div class="input-group">
                    <fieldset>
                        <legend>Inserisci post</legend>
                        <p class="container">
                            <textarea class="input-block-level" id="summernote" name="testopost" rows="18">
                            </textarea>
                        </p>
                    </fieldset>
                    <button type="submit" class="btn btn-primary">Salva</button>
                    </form>
                </div>
            </div>
        </div>
    </div>

</div>


</form>

...结果 我从表单中找到db中的数据 数据发布 nome autore titolo帖子 argomento邮报 但是从夏天的字段中我发现文本没有图像,我在文件夹服务器中看不到任何图像 图像

如果我在db中尝试链接相同,请参阅描述链接没有链接......

你能帮帮我吗

0 个答案:

没有答案