简体   繁体   English

如何在不使用PHP的文件处理功能的情况下通过PHP将HTTP内容中的二进制内容上传到MYSQL数据库中?

[英]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.

相关问题 如何使用multipart将REQUEST值添加到HTTP POST方法,以将文件上传到Android中的PHP服务器? - How do I add REQUEST values to an HTTP POST method using multipart to upload a file to a PHP server in Android? 我们如何使用php将文件上传到mysql数据库 - How do we upload a file to mysql database using php 如何在没有本地存储的情况下通过 PHP 将文件上传从 HTML 表单发送到 S3? - How do I send a file upload from an HTML form to S3 via PHP without local storage? PHP:如何从数据库(或二进制文件内容)构造zip文件? - PHP: How to construct zip file from database (or binary file content)? 尝试使用php从iOS连接到MySQL数据库(HTTP POST) - Trying to connect from iOS to MySQL Database using php ( HTTP POST ) 如何使用 PHP 在 mysql 数据库中导入 a.sql 文件? - How do I import a .sql file in mysql database using PHP? 在POST之前但在PHP中上传后使用文件上传后,如何显示图像 - How do I show image after using file upload before POST but after upload in PHP 如何在不使用ajax的情况下将数据从一个php文件发布到另一个php文件以将数据添加到数据库 - How to post data from a php file to another php file to add the data to database without using ajax 如何从MySQL数据库获取图像并使用PHP调整其尺寸? - How do I get an image from a mySQL database and resize it's dimensions using PHP? 使用PHP将文件上传转换为二进制文件,发布到服务器并保存文件 - Converting file upload to binary, post to server and save file using PHP
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM