【问题标题】:Cloudinary image upload using Javascript example使用 Javascript 示例上传 Cloudinary 图像
【发布时间】:2015-12-19 00:34:35
【问题描述】:

我使用 Javascript 和 jQuery 运行 Cloudinary 图像上传程序,而不使用 server.my。我的问题是我按照 Cloudinary jQuery 插件的说明进行操作,但图片没有上传。请张贴答案。 我的代码如下:

<html>
<head>
 <script type="text/javascript">
     $.cloudinary.config({cloud_name:'mycloudname', api_key:’myapikey'});
          $.ajax({
           url: 'http://res.cloudinary.com/mycloudname/image/upload/v1442240142/',
           type: 'POST',
           success: function (response) {
               $('#uploadinput').attr('data-form-data', response);
           }
       });
   </script>
   </head>
   <body>
<script src='js/jquery.min.js' type='text/javascript'></script>
<script src='js/jquery.ui.widget.js' type='text/javascript'></script>
<script src='js/jquery.iframe-transport.js' type='text/javascript'></script>
<script src='js/jquery.fileupload.js' type='text/javascript'></script>
<script src='js/jquery.cloudinary.js' type='text/javascript'></script>
<input name="file" type="file" id="File1" class="cloudinary-fileupload" data-cloudinary-field="image_upload"></input>

   </body>
   </html>

【问题讨论】:

    标签: image file-upload cloudinary


    【解决方案1】:

    这里有各种各样的问题:

    1. 网址应该不同,例如,

      https://api.cloudinary.com/v1_1/mycloudname/image/upload
      
    2. 如果您不想使用您的服务器,那么您应该使用未签名的上传,您还必须包含上传预设。

    请查看以下内容以获取更多信息: http://cloudinary.com/blog/direct_upload_made_easy_from_browser_or_mobile_app_to_the_cloud

    【讨论】:

      猜你喜欢
      • 2014-11-29
      • 2018-07-29
      • 2020-04-07
      • 2021-03-20
      • 2020-03-02
      • 2017-08-22
      • 2019-04-17
      • 2017-06-03
      • 2016-02-23
      相关资源
      最近更新 更多