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

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

 



Have you tried to read the manual ?
There is a lot of info on how to do this.
Anyway, I think this does the trick :

if ($handle = opendir('FULLPATHNAME')) {
   while (false !== ($file = readdir($handle))) {
       if ($file != "." && $file != "..") {

At this point, $file contains the file name.
On the next cycle, it will get the next name, and so on.


Luis

Vaibhav Sibal wrote:

Hello,
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 :


(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.

(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.

I would request all of you to please help me in this, since I am a
student and in the learning phase and this is a part of my project. If
you have any doubts about whatever I have written here  please write
to me. I would be really grateful if you all could help me in this
endeavour.

Thanks in advance

Vaibhav




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

[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux