我正在尝试执行cloudinary unsigned uploads。我在html中有文件标签,现在我正在尝试通过JavaScript初始化它。但是,我收到了很好的错误,说明$.cloudinary.unsigned_upload_tag is not a function
。这是令人遗憾的代码:
图书馆内容
<script src="https://code.jquery.com/jquery-2.2.3.min.js" integrity="sha256-a23g1Nt4dtEYOj7bR+vTu7+T8VP13humZFBJNIYoEJo=" crossorigin="anonymous"></script>
<script type="text/javascript" src="https://cdn.rawgit.com/cloudinary/cloudinary_js/master/js/jquery.ui.widget.js"></script>
<script type="text/javascript" src="https://cdn.rawgit.com/cloudinary/cloudinary_js/master/js/jquery.iframe-transport.js"></script>
<script type="text/javascript" src="https://cdn.rawgit.com/cloudinary/cloudinary_js/master/js/jquery.fileupload.js"></script>
<script type="text/javascript" src="https://cdn.rawgit.com/cloudinary/pkg-cloudinary-jquery/master/cloudinary-jquery.min.js"></script>
上传代码
<input type="file" id="selectedFile" style="" />
初始化JS
$.cloudinary.config( { cloud_name: "wearnator"});
$("#selectedFile").append($.cloudinary.unsigned_upload_tag("af8fvvkw",{ cloud_name: 'wearnator' }));
错误在附加行上。更奇怪的是,每当我选择一个文件时,上传 都会被触发,但它会上传鲜花的样本图片。
答案 0 :(得分:1)
输入字段应包含name="file"
属性:
<input type="file" name="file" id="selectedFile" />
JS初始化应该是:
$("#selectedFile").unsigned_cloudinary_upload("af8fvvkw",{ cloud_name: 'wearnator' });
让我知道它是否适合你?