Aside from renaming or moving it when the upload is finished to specify such, your best option is to keep an eye on the file (programmatically). Either watch the modified time or the file size. When it hasn't changed in a minute or so, the file is probably done. Something like this...
my %files = ('foo.txt' => [0,time()], 'bar.csv' => [0,time()]); while(%files) { for(keys %files) { if((-s $_ == $files{$_}[0]) && (time()-$files{$_}[1]>60)) { &move_file($_); delete $files{$_}; } else { $files{$_} = [(-s $_),time()]; } sleep 1; } }
this is not tested, and could be optimized, but what it does is have a hash of files (which you could add to as you go along). The values of the hash is an array holding file size and time it last changed. The code checks to see if the size has changed, and if the time it hasn't changed is over 60 seconds... You have to leave some amount of time since data tends to be written in chunks.

If windows changes the modified time as the file gets written a simple

if(time() - (stat $file)[9] > 60)
would be a sufficient test to see if $file has changed in the last 60 seconds...

                - Ant
                - Some of my best work - (1 2 3)


In reply to Re: Watching Creation File and send it to Server by suaveant
in thread Watching Creation File and send it to Server by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.