[英]How do I upload binary content from an HTTP post into a MYSQL database through PHP without using PHP's file handling functions?
This may not be possible, but I'd like to ask anyway and see if there's a creative solution out there. 这可能无法实现,但是无论如何我想问一问,看看是否有创意的解决方案。
I'd like to have a "file" form field on my site that uploads a file into a BLOB field in a MYSQL database. 我想在我的网站上有一个“文件”表单字段,该文件字段将文件上传到MYSQL数据库的BLOB字段中。 I must use PHP to accomplish this task.
我必须使用PHP才能完成此任务。
Normally, I know you would open the temp file found in the $_FILES array, using fopen(), then add the data to the db that way. 通常,我知道您会使用fopen()打开$ _FILES数组中的临时文件,然后以这种方式将数据添加到db中。 In this case however, the fopen() function, and pretty much all other file handling functions (file_get_contents, etc) are disabled in php.ini.
但是,在这种情况下,php.ini中禁用了fopen()函数以及几乎所有其他文件处理函数(file_get_contents等)。
Is there a way to get the file data from the HTTP post and put it into the MYSQL database without relying on the file handling functions built into PHP? 有没有一种方法可以从HTTP发布中获取文件数据并将其放入MYSQL数据库,而无需依赖PHP内置的文件处理功能?
PS shell_exec is also disabled PS shell_exec也被禁用
如果您可以访问$HTTP_RAW_POST_DATA
变量,那么您应该能够手动解析文件数据。
没有fopen或file_get_contents,您不能将任何文件上传到数据库..为什么不尝试ftp函数(fput等)?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.