【问题标题】:Cloudinary Image Upload Using PHP Not Working使用 PHP 上传 Cloudinary 图像不起作用
【发布时间】:2016-02-23 19:25:07
【问题描述】:

我使用 cloudinary 上传图片,我尝试了所有可能的方法来上传图片,但我的代码卡在了..

$cloudUpload = \Cloudinary\Uploader::upload($_FILES["fileToUpload"]['tmp_name']);

这是我的代码,

<?php
require 'Cloudinary.php';
require 'Uploader.php';

\Cloudinary::config(array(
    "cloud_name" => "xxxxx",
    "api_key" => "xxxxxxxxxx",
    "api_secret" => "_xxxxxxxxxxxxxx"
));

if (isset($_POST["submit"])) {
    print_r($_FILES["fileToUpload"]);
    $cloudUpload = \Cloudinary\Uploader::upload($_FILES["fileToUpload"]['tmp_name']);
    print_r($cloudUpload);
}

?>
<!DOCTYPE HTML>
  <html>
    <head>
  </head>

  <body>

<form method="post" enctype="multipart/form-data">
    Select image to upload:
    <input type="file" name="fileToUpload" id="fileToUpload">
    <input type="submit" value="Upload Image" name="submit">
</form>

  </body>
</html>

我根本没有从 cloudinary 得到任何响应,并且顶部的 require 行没有错误。

请帮忙!

【问题讨论】:

    标签: php cloudinary


    【解决方案1】:

    您的代码对我来说效果很好。 确保您的凭据和 Cloudinary 帐户一切正常。 如果此问题仍然存在,如需进一步和更多针对特定帐户的帮助,您应通过 Cloudinary 联系 open a support-ticket

    【讨论】:

      【解决方案2】:

      对于这个问题的任何绊脚石,还要检查你的 php 版本。 Cloudinary PHP SDK 需要 php 5.4。

      【讨论】:

        猜你喜欢
        • 2021-08-29
        • 2017-06-03
        • 1970-01-01
        • 1970-01-01
        • 2012-06-22
        • 2021-02-20
        • 2020-04-07
        • 2018-02-07
        • 2016-04-07
        相关资源
        最近更新 更多