in reply to Re: issue with checking file size
in thread issue with checking file size

Thanks, that got me closer now it's saying no file in that directory, which leads me to believe that I'm not locating the correct file... or maybe I need to identify it better in someway. as right now I'm just using a variable that holds the file information thanks for the help.

Replies are listed 'Best First'.
Re^3: issue with checking file size
by almut (Canon) on Mar 13, 2008 at 19:15 UTC
    now it's saying no file in that directory, which leads me to believe that I'm not locating the correct file...

    Not sure I understand. What exactly is saying "no file in that directory", and what do you mean by locating the file?

    AFAICT, the code writes the content of $work to a file which is created with the path

    "C:\\wamp\\www\\Web Forms\\Data\\Critique\\$company\\$file"

    Presuming the writing of the file succeeded, you should be able to successfully stat() the file afterwards, if you use the exact same path that you used to create the file...

    So, have you checked whether the file gets created/written at all?  Is the $company component of the path a valid (existing) directory?  Do you have appropriate permissions to write the file?  Is there an error message when trying to open the file?

    I'd start debugging with printing out the path to see what the variable parts coming from the form ($company\$file) were set to... Also, you can make your life a little easier, if you assign the path once to some variable, which you then use everywhere, i.e. in the open(), the corresponding error message, the stat(), in debug prints, etc. For example:

    ... my $path = "C:\\wamp\\www\\Web Forms\\Data\\Critique\\$company\\$file" +; # print STDERR "$path\n"; # debug open(F, ">", $path) or die "Cannot create '$path': $!"; print F $work; close(F); my $size = (stat $path)[7]; ...