Results 1 to 1 of 1

Thread: Having trouble working with "stat( )"...

  1. #1
    Join Date
    Sep 2008
    Midland, Texas
    Thanked 0 Times in 0 Posts

    Question Having trouble working with "stat( )"...

    I am trying to make a form that will show the contents of all uploaded files. Now, I have tried the stat( ) using numeric and relational indexes, but for some reason continues to display the following error:

    Warning: stat( ) [function.stat]: stat failed for PHP MySQL Introduction.doc...

    for($i = 0; $i < count($directory); $i++){
    $details = stat($directory[$i]);
    $uploads .= "<tr>\n";
    $uploads .= "<td><a href=\"../uploads/".$directory[$i]."\" target=\"_blank\">".$directory[$i]."</a></td>\n";
    $uploads .= "<td>".$details[7]."</td>\n";
    $uploads .= "<td>".$details[9]."</td>\n";
    $uploads .= "</tr>\n";
    clearstatcache( );

    Can anyone shed some light on this subject? I also tried using the filesize( ), but it displays a similar error. Thanks in advance for your help.


    I guess it is too late not to look stupid. The reason why I was getting an error is because as you will see above, I was using "stat( )" with only the file name "stat($directory[$i])", instead of giving it the entire path to the file, "stat('../uploads/'.$directory[$i]);". Anyway, I appreciate all of those who took the time to at least view the posting. Thanks anyway! Cheers! :-)
    Last edited by xtiano77; 05-27-2009 at 04:58 PM. Reason: Figured out the answer to the problem.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts