douyan1972 2013-12-26 11:26
浏览 285
已采纳

cURL命令行使用FTP将文件发送到网站目录

I have a website hosted in localhost. I'm using as a web server "EasyPHP".

I need to use a command line by cURL to send a file to a directory of the website.

Let's suppose that the URL of the website is :

localhost/testing_curl

And that "some_package.zip" is under the local directory :

C:\testing

So I need to make this command line work from MS-dos terminal :

curl -T some_package.zip localhost/test_curl/new_package_name.zip

And this :

curl -T some_package.zip http://localhost/test_curl/new_package_name.zip

I checked the configuration file php.ini and I un-commented this :

extension=php_curl.dll

Then I restarted EasyPHP. But this didn't help.

I keep get this error message :

  The PUT
  method is not allowed for the requested URL.

under this error code :

  Error 405

For info : This worked for me to send a header : How to send header using PHP curl command line?

  • 写回答

1条回答 默认 最新

  • douci1851 2013-12-26 15:29
    关注

    Here what I've done to resolve the problem :

    1. Control Panel > Security Center > Firewall > Exception > Add port. Then I added two ports :

      Name : FTP Server Value : 21

      Name : FTP-Data Value : 20

    2. I installed FileZilla Server : here

    3. FileZilla > Edit > Users > Add . Then I added a new user with password.

    4. I shared these folders to the user I've created :

      Only read right : C:\Program Files\EasyPHP 3.0\www

      Full right (and absolutely "write" right) : C:\Program Files\EasyPHP 3.0\www\test_curl

    5. I changed the curl command line to this (replace the variables by the right value):

      curl --user %user_name%:%password% --ftp-create-dirs -T some_package.zip ftp://localhost/test_curl/new_package_name.zip

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Acrn IVSHMEM doorbell问题
  • ¥15 yolov5中的val测试集训练时数量变小问题
  • ¥15 MPLS/VPN实验中MPLS的配置问题
  • ¥15 materialstudio氢键计算问题
  • ¥15 已知隐函数其中一个变量的,求另外一个变量
  • ¥15 echarts图表制作
  • ¥15 halcon根据玻璃面板纹路取区域
  • ¥15 HFSS设计小型化180度耦合器
  • ¥15 使用CInternetSession,CHttpFile读取网页文件时有些电脑上会卡住怎么办?
  • ¥15 水下机器人的半物理仿真研究