0

Dear all,

i have a php script to download list of files from server. it is working well, when i type the file address. but i want to get address of file from user.

i have a html page where user select Folder and Sub Folder name to download file list. and submit the page. the folder and Sub Folder name will be sent via POST method to other page where is the my download list script.

when i put the received variables in the script it doesn't work. it show a error message the the dir not found.

but when i type the address in the script it works.

i have checked that variables which is receiving from another page is Right.

Please help me to slove it.

my script is :

<?php 

$folder=$_POST['folder'];
$sfolder=$_POST['sfolder'];

//echo $folder;
//echo $sfolder;


$rec = opendir("$folder/$sfolder");

if($rec = opendir) {

	echo"<b><u>Directory have these Files & Folders:</u></b>";
	
	echo "<select>
	<option>Select File </option>";

	while(false !== ($dir = readdir($handle))) {
		

		echo"<option>$dir</option>";
		
	}
	echo"</select>";
	
	closedir($rec);
}

?>

Edited by peter_budo: Keep It Clear - Do wrap your programming code blocks within [code] ... [/code] tags

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by Henzard
0
<?php 

$folder=$_POST['folder'];
$sfolder=$_POST['sfolder'];

//echo $folder;
//echo $sfolder;


$rec = opendir("$folder/$sfolder");

if($rec = opendir) {

echo"<b><u>Directory have these Files & Folders:</u></b>";

echo "<select>
<option>Select File </option>";

while(false !== ($dir = readdir($handle))) {


echo"<option>$dir</option>";

}
echo"</select>";

closedir($rec);
}

?>

Edited by peter_budo: Keep It Clear - Do wrap your programming code blocks within [code] ... [/code] tags

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.