NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
SRV web server and file uploads


Joined: 21 Nov 2003
Posts: 39
Reply with quote
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.
View user's profileFind all posts by netgertSend private messageVisit poster's websiteMSN Messenger
Site Admin

Joined: 13 Jul 2003
Posts: 7861
Reply with quote
Sure, you'd better use Apache either remote or local one. In both cases you'll have to set "Remote HTTP" run mode.
You can for example install Apache that's boundled with Nusphere Tech Platform 3.1. See Nusphere free products page
http://www.nusphere.com/cgi-bin/nsp.cgi/custsrvc/utils/free_download.htm

Just want to let you know that problem with handling file uploads in SRV was fixed in PHPED 3.3


Last edited by dmitri on Thu Feb 12, 2004 10:20 am; edited 1 time in total
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 21 Nov 2003
Posts: 39
Reply with quote
Got it working finally. I forgot to specify the port 9000 and I had to configure Apache to use a virtual host which root's is the phpED Projects folder
View user's profileFind all posts by netgertSend private messageVisit poster's websiteMSN Messenger
SRV web server and file uploads
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic