Re: Is there a way I can read full path names of files on the server and enter it into the database ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Vaibhav Sibal wrote:
> I wanted to ask whether there is a way whereby a script can read
> filenames from a particular directory on the server and enter those
> filenames with the complete path into the MySQL database? I am trying
> to do this, because I am developing an application where a supervisor
> will be distributing files to different users, and those users are to
> work on the files allocated to them by the supervisor. There is a big
> pool of files containing around 10k-15k files and the supervisor will
> be instructed to allocate around 200 files to a user each day, and the
> user should be able to open that file and work on it. I am using a
> Linux Fedora core 2 server running Apache 2.0.53 and PHP 5.0.3 and
> MySQL, and my clients are Windows clients. So I wanted to ask all of
> you people what would be a better approach to do this, the following
> are the 2 options :

I hope the work load for a single file is rather low -- 200 files to edit
seems like an awful lot...

> (1)As soon as the supervisor selects say around 200 files for a user
> called robert, 200 files from the file pool automatically get copied
> to the home directory of robert. While they are copied to the home
> directory of Robert, the name of each file with their complete path
> name gets logged onto the database. Now I am doing since because I
> need to know where each file went and what user is working on what
> file.  Now since robert is working on a client running on windows, we
> can map a drive of windows onto the home directory of robert. In this
> scenario can we instruct PHP to open files from a local directory
> (i.e. the mapped directory of windows)? Because I need to, somehow,
> log when a user opened the file and when he closed it.

I would avoid this route -- Mainly because to give PHP permission to copy
files onto Robert's computer will open up some pretty major security holes
in every single desktop machine.

> (2) The second scenario is that, I just enter the name of the files
> allocated to a user alongwith the complete pathnames to a database and
> I have another column this time where I store the user's name. Now
> whenever the user logs into our system using his username and
> password, and checks to see his work, he sees a list of files on the
> browser itself, but now we will have to convert this list of files
> into links so that the user can click on the links and directly open
> the file in the required software from the server itself. The issue,
> again, in this kind of design is that how do i open the file in the
> required software and even if i do it then how do i record when the
> user opened the file and when he finished working on it.

This seems perfectly reasonable approach.

Once you have assigned a file to 'robert' in the database, then you can
let 'robert' download the file -- or even a zip file with all 200 files in
it.

The downloaded file will have the correct Windows extension -- or they
will after 'robert' unzips them, and Windows will open the right software,
if 'robert' has it installed and the machine is configured correctly.

If it's not installed or the machine isn't configured correctly, there is
nothing you can do about it from PHP.

Then 'robert' can work on them, and, when they are finished, they can
upload the edited files.

You can track when 'robert' downloaded the files, and when 'robert'
uploaded the files.

If you want to do it one file at a time you could track each and every
download/upload -- but it would be very painful for 'robert' to download
every single file and upload every single file.

Most likely, just knowing that 'robert' downloaded 200 files, took 43
minutes to work on them, and uploaded them again, is plenty of info to
track productivity.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux