hey guys anyone know here how to browse image from server? currently the code <input type="file" name="file" id="file" /> is browsing from my computer. I want it to browse from the server, is it possible? thanks in advance

thanks for the reply but that didn't help me, i tried that code but it only returned weird characters, i only want the normal input file we use in uploading but i want it to browse file from the server instead of my computer

<input type="file" name="file" id="file" />

source and destination servers are same or different

no i think we misunderstood each other, im not uploading, i only ask if we can specify the

<input type="file" name="file" id="file" />

to browse on the server instead on my computer. Like for example i have a module on the backend and i want my banner image replaced, currently the path is on a textfield. i don't want user to explicitly write and specify the correct path to the image, i want the user just to browse on the images available on the server, thanks for the reply btw :)

I think we can do that, but making your own browse window. as you find on browser based ftp managers. where user will browse server directories.

Another way we can do is instead of file field, if user knows the file path of file name(in case folder is fixed), give only text box where user will write the file path or name.

yes that's my current operation, users will have textfield where they write the path to the image. i think ill try the browser window, if u had a sample code on how to do it i would grateful thanks

I have sever browsing code, but you need to find some way that how to select file and copy path to server. also find 2 images below for better view.

<?php



	session_start();
	

	if (trim($_POST['dirname'])=="")
		$currdirectory=dirname($_SERVER['DOCUMENT_ROOT']);
	else
		$currdirectory=$_POST['dirname'];
	$_SESSION['dirname']=$currdirectory;			

	
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=unicode">
<META content="MSHTML 6.00.2900.2180" name=GENERATOR></HEAD>
<script lang=javascript>
	function link_click(dname)
	{
		document.frmdir.dirname.value=dname;
		document.frmdir.submit();
	}
</script>
<BODY>

<?php
	
	$files = scandir($currdirectory);
	print "<b><BR>{$currdirectory}</b><br>";
	
	if (!(substr(strrev(trim($currdirectory)),0,1)=='/' ||substr(strrev(trim($currdirectory)),0,1)=='\\'))

		
	print "<a href=\"javascript:link_click('".str_replace('\\','',dirname($currdirectory))."')\">Up</a><br>";
?>

<?php


	print "<form method='post' name=frmdir id=frmdir action='{$_SERVER['PHP_SELF']}'>";
	print "\n<table border=0>";
	for ($i=0;$i<count($files);$i++)
	{
		
		$content=$currdirectory."/".$files[$i];
	 	
	 	if (is_dir($content) && trim($files[$i])!="." && trim($files[$i])!="..")
	 	{
			print "\n<tr>";	 	 
			print "\n\t<td valign=bottom><img src='./folder.jpg' border=0 >	</td>";
			print "<td><a href=\"javascript:link_click('".$content."')\">{$files[$i]}</td></a>";	 	
	 		print "\n</tr>";
		}

	}

	for ($i=0;$i<count($files);$i++)
	{
		 $content=$currdirectory."/".$files[$i];
	 	if (is_file($content))
	 	{
 			print "\n<tr>";
			print "\n\t<td valign=center align=right><img src='./file.jpg' border=0></td>";	 	 
			print "\n\t<td><span >{$files[$i]}</span>";
	 		print "\n</td></tr>";
		}

	}
	print "\n</table>";
?> 
<input name=dirname id=dirname type=hidden>
</form>


</BODY></HTML>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.