Froala PHP SDK 错误:字段名称不正确它必须是:文件

问题描述

我正在开发一个文章发布实用程序,我正在使用包含在表单中的 Froala 的 WYSIWYG textarea 文本编辑器,在将文章的基本信息存储在数据库中后,我想将上传的图像存储在文本编辑器中在服务器上,问题是当我使用他们的 PHP SDK 存储文档中提到的图像时,出现此错误Fieldname 不正确。它必须是:文件

这是表单的html:

<form method="post" class="mt-5" action="<?PHP echo htmlspecialchars($_SERVER['PHP_SELF']);?>"> 
    <div class="form-group row justify-content-center">
                <div class="col-sm-9">
                    <label for="uname" style="color:#B1DDF1;"><b>Your Article's title</b></label>
                    <input type="text" id="focusedInput" class="form-control" name="title" placeholder="Make it creative!...">
                </div>
            </div>
            <div class="form-group mt-2">
                <label for="comment" style="color:#B1DDF1;"><b>Content goes here...</b></label>
                <div id="editor"><textarea  class="form-control" cols="200" rows="200"id='edit' name="file" placeholder="Type some text"><h1>This is a heading</h1>
                    <p>start writing your article here!</p></textarea></div>
            </div>
            <div class=" row mt-2 justify-content-center">
                <input type="submit" class=" col-xs-6" value="Publish me!">
            </div>
        </form>

这是PHP代码的一部分:

 $lastid=$conn->lastInsertId(); // get the new article's id for ressources management 
      $newarticfold="../LIGHT/articles_ressources/".$lastid; 
      try{
        if(mkdir($newarticfold)){
          require("wysiwygPHP/lib/FroalaEditor.PHP");
          $path="/Freelancing/CarthageP/test/LIGHT/articles_ressources/".$lastid."/"; //specifying the path from $_SERVER["DOCUMENT_ROOT"]
          $resp=FroalaEditor_Image::upload($path);
          echo("<div class='alert alert-success'>yaaay images got uploaded yaaaaay</div>");
        }
        
      }

我尝试将 textarea 的名称更改为文件,多次阅读文档,并尝试在 google 上搜索错误消息,但没有找到任何相关信息,导致此类问题的可能原因是什么?是固定的吗?预先非常感谢您!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...