以文本方式上傳二進(jìn)制文件的PHP程序
更新時(shí)間:2006年10月09日 00:00:00 作者:
現(xiàn)在有的站點(diǎn)上傳文件的時(shí)候會(huì)自動(dòng)在文件前面加入Content-type: image/gif等頭標(biāo),導(dǎo)致二進(jìn)制文件被破壞。因此,我編寫(xiě)了以文本方式上傳二進(jìn)制文件的PHP程序。
一共兩個(gè)文件:index.php,action.php。將要上傳的文件的文件名改為test,與這兩個(gè)文件放在一起,運(yùn)行index.php,選讀取,將讀取的所有數(shù)據(jù)Copy,在遠(yuǎn)端服務(wù)器上面也運(yùn)行這個(gè)程序,Paste到輸入框中,選保存。二進(jìn)制文件就被上傳了。
index.php
---------------------------------------------------------
<html>
<head>
<title>以文本方式上傳二進(jìn)制文件的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>
<br>
<input type="radio" name="view" value="0" checked>
保存
<input type="radio" name="view" value="1">
試看
<input type="radio" name="view" value="2">
讀取<br>
<input type="submit" name="OK" value=" 確 定 ">
<input type="reset" name="RESET" value=" 取 消 ">
</div>
</form>
</td>
</tr>
</table>
</body>
</html>
---------------------------------------------------------
action.php
---------------------------------------------------------
<?
一共兩個(gè)文件:index.php,action.php。將要上傳的文件的文件名改為test,與這兩個(gè)文件放在一起,運(yùn)行index.php,選讀取,將讀取的所有數(shù)據(jù)Copy,在遠(yuǎn)端服務(wù)器上面也運(yùn)行這個(gè)程序,Paste到輸入框中,選保存。二進(jìn)制文件就被上傳了。
index.php
---------------------------------------------------------
<html>
<head>
<title>以文本方式上傳二進(jìn)制文件的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>
<br>
<input type="radio" name="view" value="0" checked>
保存
<input type="radio" name="view" value="1">
試看
<input type="radio" name="view" value="2">
讀取<br>
<input type="submit" name="OK" value=" 確 定 ">
<input type="reset" name="RESET" value=" 取 消 ">
</div>
</form>
</td>
</tr>
</table>
</body>
</html>
---------------------------------------------------------
action.php
---------------------------------------------------------
<?
相關(guān)文章
php替換超長(zhǎng)文本中的特殊字符的函數(shù)代碼
php替換超長(zhǎng)文本中的特殊字符的函數(shù),主要就是通過(guò)str_replace實(shí)現(xiàn)字符的簡(jiǎn)單體會(huì)2012-05-05PHP的mysqli_rollback()函數(shù)講解
今天小編就為大家分享一篇關(guān)于PHP的mysqli_rollback()函數(shù)講解,小編覺(jué)得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來(lái)看看吧2019-01-01如何使用動(dòng)態(tài)共享對(duì)象的模式來(lái)安裝PHP
如何使用動(dòng)態(tài)共享對(duì)象的模式來(lái)安裝PHP...2006-10-10