使用curl发布文件有大小限制吗? [英] Is there any size limit to post a file using curl?

查看:1620
本文介绍了使用curl发布文件有大小限制吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将最大50mb的文件发布到电报bot api.

I need to post files up to 50mb to telegram bot api.

现在,我正在使用Curl,所有内容均已测试并成功通过.意味着我只能发送小文件(在测试中我不能发送8.1mb文件).因此,如果我发送大文件(比如说超过8mb),则所有$_POST变量都为空,表示什么都没有发布.

Now I'm using Curl and everything tested and passed successfully. Means that I can only send small files (I coudn't send 8.1mb file in my test). So if I send large files (lets say more than 8mb) all $_POST variables are empty, means nothing posted.

问题:使用curl发送文件是否有任何限制?因为我要求服务器管理员增加php.ini中的相关配置,但是他们回答说这不是php.ini的问题,并且curl没有限制.

Question: Is there any limitation in sending file using curl? Because I asked my server administrator to increase related configuration in php.ini, but they replied that is not php.ini's problem and there is no limitation in curl.

提前谢谢.

推荐答案

上传限制是一项安全功能.没有它们,流氓程序或攻击者可能会向服务器提供连续的数据流,直到硬盘装满为止,从而使整个服务器无法使用.

Upload limits are a security feature. Without them, a rogue program or attacker could feed your server with a continuous stream of data until your hard disk is full, thus rendering the whole server unusable.

从安全角度来看,限制外发数据并不是特别有用,据我所知,Curl库和PHP本身都没有施加任何限制.

From the security standpoint it isn't particularly useful to restrict outgoing data and, as far as I know, neither the Curl library nor PHP itself impose any limit.

您的症状表明问题出在目标服​​务器上.由于您似乎可以访问它(提到空$_POST),因此建议您在此处验证上传限制.您可以自己做(并且经常更改),而不必询问服务器管理员.主要涉及的指令包括:

Your symptoms suggest the problem is on the destination server. Since you appear to have access to it (you mention getting empty $_POST) I suggest you verify upload limits there. That's something you can do (and often change) yourself, you don't have to ask the server administrator. Main involved directives include:

  • post_max_size
  • upload_max_filesize
  • max_file_uploads
  • max_input_time

您可以使用phpinfo()ini_get()对其进行检查,并且可以通常的方式进行更改.

You can inspect them with phpinfo() or ini_get() and you can change them the usual way.

这篇关于使用curl发布文件有大小限制吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆