【问题标题】:How to upload a file using curl that creates a directory in server如何使用在服务器中创建目录的 curl 上传文件
【发布时间】:2016-06-23 23:10:37
【问题描述】:

我可以通过以下方式使用 cURL 命令上传文件,

curl --upload-file 文件名http://example.com/upload/

Web 服务器是 Apache。它已经创建了一个目录“上传”。

但是当我执行以下操作时,它会失败,

curl --upload-file 文件名http://example.com/upload/subdirectory/

cURL报如下错误,

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don't have permission to access /upload/subdirectory/file_name
on this server.</p>
<hr>
<address>Apache/2.4.7 (Ubuntu) Server at example.com Port 80</address>
</body></html>

我的要求是让cURL在“上传”下创建一个带有“子目录”的目录,并复制文件“file_name”。

我猜是在 Apache 配置文件中做一些事情。 任何想法。

【问题讨论】:

    标签: apache ubuntu curl


    【解决方案1】:

    你是对的,你可能有某种 Apache 重定向设置 - 但即便如此,你仍然需要某种 php 文件来处理你的 put 请求。这不是 curl 在客户端可以做的事情。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-08-16
      • 2010-10-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-14
      • 2012-11-07
      相关资源
      最近更新 更多