| 
		
		 
  
				
		 
		
			| Joined: 21 Nov 2003 |  
			| Posts: 39 |  
			 |  
		 
		 
	 | 
	  | 
	
	
		  Posted: Thu Nov 20, 2003 3:31 pm | 
		 | 
		  | 
		  | 
	 
	
		  | 
		  | 
	 
	 
	I cannot get the SRV server to correctly accept uploaded files. Is there any way or do I really have to use remote web server? If i browse a file and hit submit, the $_FILE array will be completely empty.
 
Here's the source of the fup.php I tried:
 
<html>
 
<head>
 
	<title>File upload</title>
 
</head>
 
<body>
 
<?php
 
$num = $_REQUEST["num"];
 
if (!$num) $num = 1;
 
print "<p>Välju: $num</p>\n";
 
if ($_REQUEST["upload"] == "yes") {
 
	print "<p>File status:<br>\n";
 
	for ($i = 0; $i < $num; $i++) {
 
		print "<i>" . $_FILES["pic"]["name"][$i] . "</i> - <b><span style="color: #";
 
		if (move_uploaded_file($_FILES["pic"]["tmp_name"][$i], getcwd() . "/" . $_FILES["pic"]["name"][$i])) print "008800">Successfully uploaded";
 
		else print "880000">Failed to upload";
 
		print "</span></b><br>\n";
 
	}
 
	print "</p>\n";
 
}
 
?>
 
<form action="fup.php" method="POST" enctype="multipart/form-data">
 
<input type="hidden" name="upload" value="yes">
 
<input type="hidden" name="num" value="<?php print $num ?>">
 
<?php
 
for ($i = 0; $i < $num; $i++) print "<input type="file" name="pic[]"><br>\n";
 
?>
 
<input type="submit" value="Lae ülesse">
 
</form>
 
<form action="fup.php" method="POST">
 
<select name="num">
 
	<option>1</option>
 
	<option>3</option>
 
	<option>5</option>
 
	<option>10</option>
 
</select>
 
<input type="submit" value="Sea väljade arv">
 
</form>
 
</body>
 
 
--------------------------------
 
 
The header SRV gets from client:
 
GET /file:/C:/Documents%20and%20Settings/Gert/My%20Documents/php/fup.php?DBGSESSID=-1 HTTP/1.1
 
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/msword, application/x-shockwave-flash, */*
 
Accept-Language: et
 
Accept-Encoding: gzip, deflate
 
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
 
Host: localhost:8080
 
Connection: Keep-Alive
 
Cookie: DBGSESSID=379469281654400016@clienthost:7869
 
_________________________________________
 
 
POST /file:/C:/Documents%20and%20Settings/Gert/My%20Documents/php/fup.php HTTP/1.1
 
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/msword, application/x-shockwave-flash, */*
 
Referer: http://localhost:8080/file:/C:/Documents%20and%20Settings/Gert/My%20Documents/php/fup.php?DBGSESSID=-1
 
Accept-Language: et
 
Content-Type: multipart/form-data; boundary=---------------------------7d33af17801d0
 
Accept-Encoding: gzip, deflate
 
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
 
Host: localhost:8080
 
Content-Length: 384
 
Connection: Keep-Alive
 
Cache-Control: no-cache
 
Cookie: DBGSESSID=-1
 
 
--------------------------------------------
 
 
The headers SRV sends:
 
HTTP/1.1 200 OK
 
Connection: keep-alive
 
Content-Type: text/html
 
Content-Length: 611
 
Cache-control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
 
Expires: Thu, 19 Nov 1981 05:00:02 +0200
 
Pragma: no-cache
 
Server: Indy/9.0.11
 
Set-Cookie: DBGSESSID=-1
 
_________________________________________
 
HTTP/1.1 200 OK
 
Connection: keep-alive
 
Content-Type: text/html
 
Content-Length: 579
 
Cache-control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
 
Expires: Thu, 19 Nov 1981 05:00:02 +0200
 
Pragma: no-cache
 
Server: Indy/9.0.11
 
Set-Cookie: DBGSESSID=-1
 
 
This did work when I tried it on apache and on a remote web server, so I guess it's a missing/malfunctioning feature of SRV. 
	 |