61
網頁技術 / Re: PHP下載檔案毁損?
« 於: 2011-08-17 15:38 »
修改了一下,檔案下載的大小是1KB,
用notepad的訊息是success
用notepad的訊息是success
這裡允許您檢視這個會員的所有文章。請注意, 您只能看見您有權限閱讀的文章。
<?php
if(empty($_GET['path']) || empty($_GET['filename']))
{
echo 'error path';
exit();
}
if(file_exists($_GET['path']))
{
$FILEname = urlencode($_GET['filename']);
if(ini_get('zlib.output_compression'))
ini_set('zlib.output_compression', 'Off');
header("Content-Type: application/octetstream; name=$FILEname"); //for IE & Opera
header("Content-Type: application/octet-stream; name=$FILEname"); //for the rest
header("Content-Disposition: attachment; filename=$FILEname;");
header("Content-Transfer-Encoding: binary");
header("Content-Type: application/zip");
header("Cache-Control: cache, must-revalidate");
header("Pragma: public");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT");
readfile($_GET['path']);
echo "success";
}
else
echo 'file doesnt exist';
?>
<?php
// define some variables
$local_file = "local.zip";
$server_file = "server.zip";
$ftp_user_name="user";
$ftp_user_pass="userpass";
$ftp_server="192.168.1.1";
$port = "3837";
// set up basic connection
$conn_id = ftp_connect($ftp_server,$port);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// uncomment if you need to change directories
if (ftp_chdir($conn_id, "DOWNLOAD")) {
echo "Current directory is now: " . ftp_pwd($conn_id) . "\n";
} else {
echo "Couldn't change directory\n";
}
// try to download $server_file and save to $local_file
if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) {
echo "Successfully written to $local_file\n";
} else {
echo "There was a problem\n";
}
// close the connection
ftp_close($conn_id);
?>
<html>
<body>
<div id="mymap" style="width: 500px; height: 500px"></div>
<SCRIPT>
var map = new GMap(document.getElementById("mymap"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(51.6500, 6.1833), 16);
var marker = new GMarker(new GLatLng(51.6500,6.1833));
GEvent.addListener(map, "click", function(marker, point) {
if (marker) { document.getElementById('mymap').innerHTML=' <applet width=500 height=500 code=myapp.class ARCHIVE=./apps/myapp.jar > <PARAM NAME=testingServer VALUE=tool1> <PARAM NAME=U VALUE=nars> </applet>';
...........
<button onclick="document.getElementById('mymap').innerHTML='';">Back to map</button>
//這樣只能清除applet,但是不能回到map,難道要把map再重新寫一遍嗎????????
<html>
<head>
<title>Java Applet 測試</title>
</head>
<body>
<div id="japp2"></div>
<button onclick="document.getElementById('japp2').innerHTML='<applet width=733 height=326 code=myjava.class ARCHIVE=./site/myjava.jar > <PARAM NAME=testingServer VALUE=applettest><PARAM NAME=U VALUE=nars>
</applet>';">Click Me #2</button>
<form>
<input type="button" value="Back" onclick="history.back()"> //這個按鈕要回到上一頁,也就是還沒下載applet的頁面,請問有錯嗎???????
</form>
</body>
</noframes>
</html>
<html>
<head>
<title>Java Applet 測試</title>
</head>
<body>
<div id="japp2"></div>
<button onclick="document.getElementById('japp2').innerHTML='<applet width=733 height=326 code=myjava.class ARCHIVE=./site/myjava.jar >
<PARAM NAME=testingServer VALUE=applettest>
<PARAM NAME=U VALUE=nars>
//加入參數,卻不能執行???????
</applet>';">Click Me #2</button>
</body>
</noframes>
</html>
<html>
<body>
<div id="mymap" style="width: 500px; height: 500px"></div>
<SCRIPT>
var map = new GMap(document.getElementById("mymap"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(51.6500, 6.1833), 16);
var marker = new GMarker(new GLatLng(51.6500,6.1833));
GEvent.addListener(map, "click", function(marker, point) {
// 要如何呼叫執行applet ? ????
});
map.addOverlay(marker);
</SCRIPT>
<APPLET CODE="InJava2.class"
NAME="myApplet"
HEIGHT=500 WIDTH=500 >
</APPLET>
要如何在點選map上的marker時,map會去呼執行applet ,是要用href的方式嗎?(map的大小和apple的大小是一樣的)public static void main(String[] args)
{
.................
String myName = this.getParameter("myName"); // Cannot use this in a static context
}
<applet code=Contact.class ARCHIVE="./Cpt/Contact.jar"
width=733 height=326 >
</applet>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>頁框測試</title>
</head>
<frameset rows="80,*,20%" >
<frame src="http://tw.yahoo.com" name="topFrame" scrolling="No" noresize="noresize" id="topFrame" title="topFrame" />
<frame src="http://www.google.com.tw" name="mainFrame" id="mainFrame" title="mainFrame" />
<frame src="http://www.pchome.com.tw" name="bottomFrame" scrolling="No" noresize="noresize" id="bottomFrame" title="bottomFrame" />
</frameset>
<noframes>
<body>
抱歉,你的網頁並不支援頁框,因此你無法正確的看到網頁內容
</body>
</noframes>
</html>
# cat /proc/sys/net/core/rmem_max
131071
public static void bufSize()
{
Socket destSocket = new Socket();
String destHost="127.0.0.1";
int destPort=3784;
InetSocketAddress sa = new InetSocketAddress(destHost,destPort);
System.out.println("destHost: " + destHost + ", destPort: " +
destPort);
try {
System.out.println(destSocket.getReceiveBufferSize ()); // 印出的值 43690
System.out.println(destSocket.getSendBufferSize()) ; // 印出的值 8192
} catch (SocketException e) {
e.printStackTrace();
}
}
<form name="aaa" id="aaa" action="newWindow.php" onsubmit="return check_data();" method="post" target="_blank" >