现在有的站点上传文件的时候会自动在文件前面加入Content-type: image/gif等头标,导致二进制文件被破坏。因此,我编写了以文本方式上传二进制文件的PHP程序。
一共两个文件:index.php,action.php。将要上传的文件的文件名改为test,与这两个文件放在一起,运行index.php,选读取,将读取的所有数据Copy,在远端服务器上面也运行这个程序,Paste到输入框中,选保存。二进制文件就被上传了。
index.php
---------------------------------------------------------
<html>
<head>
<title>以文本方式上传二进制文件的PHP程序</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#FFFFFF">
<table width="760" border="0" cellspacing="0" cellpadding="0" height="25">
<tr>
<td>
<div align="center"><b>图片上传</b></div>
</td>
</tr>
</table>
<table width="760" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<form name="form" method="post" action="action.php" target="_blank">
<div align="center">
<textarea name="pic" cols="80" rows="15"></textarea>
| 对此文章发表了评论 |
