tags:

views:

315

answers:

5

Hi all,

Here's the scenario. I have a simple browse button. Right now, it opens up the folder hierarchy on my local computer. (PC).

However, I want to pick a file from a remote unix server which I have access to. Is there a way to display the file hierarchy of the remote unix server WITHOUT having to mount the drive?

Are there other options other than using a java applet?

Thanks,
Michael

A: 

Don't know how it is in Unix, but in Windows, you can either map a drive letter to remote path, or simply type the remote path in the browse dialog (\\server\share\filename)

ichiban
A: 

Instead of using the regular input type file, invoke a Java applet. You can use VFS from apache to access your UNIX machines. VFS API supports many file access protocols.
http://commons.apache.org/vfs/filesystems.html

cx0der
Alright, I'll check it out and will paste my progress.
Michael
+1  A: 

If you don't really want an applet you can do it server-side in PHP by using this something like this to let the user select a folder:

<?php
$connection = ssh2_connect('host', 22);
ssh2_auth_password($connection, 'username', 'password');

$stream = ssh2_exec($connection, 'ls -a --file-type');
?>

Just parse the $stream variable to identify the folders (the ones ending with /) and present them in a table.

I guess this solves your problem. If you want the user to upload a file just put a simple file upload field, Once the user have selected a folder and uploaded a file in a temporal location in the server just move it with SSH too:

<?php
$connection = ssh2_connect('host', 22);
ssh2_auth_password($connection, 'username', 'password');

ssh2_scp_send($connection, '/temporal/filename', '/remote/filename');
?>

For getting this working you need to have enabled SSH2 libraries for PHP in your server.

victor hugo
Sigh, running into issues installing on Solaris
Michael
A: 

A friend of mine recommended Samba: http://us3.samba.org/samba/

It apparently lets you link a unix server as a windows file/print server, which should show up in a file browser. :)

Salty
A: 

I don't know why; I've had much difficulty with installing anything on the solaris machine. So i've decided to go a slightly different route -- I found out that the machine is already mounted properly, so I can simply switch user accounts to access what I need -- without SSH.

Michael