[Phpwm] file upload complete?

Phil Beynon phil at infolinkelectronics.co.uk
Wed Jul 2 17:11:05 BST 2008


Hi Alan,

What does your script for post upload processing the file do if it 
encounters the incorrect MIME type? Always check for that!
Also what happens should an empty zip file be uploaded for whatever reason? 
You can use the inbuilt PHP Zip stuff to ensure files actually exist within 
the archive.
If its not being used elsewhere consider the comment field of the zip for 
post processing result storage as an update for error level storage in case 
of any subsequent audit being needed.

> the files are coming in via FTP, they are not being posted from a form.
>
> Here is the solution your thoughts have triggered:
> the application uploads the zip file (say) 765-5.zip. when that is
> complete it sends an empty file called 765-5.end

Why have it empty?? - use it as a container for say an MD5 checksum of the 
previous file, that way you know it wasn't splashed enroute.

> Our Cron job looks for ****.end files. When we find one, use the 765-5
> to go and look for the appropriate zip file.
>
> Seems pretty safe -  somebody shoot us down!
>
> Thanks for your input, alan dunn

Thats all that immediately comes to mind here.

Phil


>
>
> Phil Beynon wrote:
>>> We have zip files being uploaded to an FTP folder from various laptops.
>>> We then plan to open those files using a cron job. My concern is that we
>>> shouldn't try to open and process a file before upload is complete.
>>>
>>> Is it OK to just use  feof = true going to do this or do we need to be
>>> more thorough?
>>>
>>> Are there methods of monitoring a file to see when upload is complete
>>> and then switching on the next stage of the process?
>>>
>>> thanks, alan dunn
>>
>> Are they being uploaded as native FTP or via a form submission from a
>> page, in which case you can capture the upload size as a variable and
>> use it to compare against.
>>
>> There is a way with .zip files of ensuring their integrity and
>> contents by parsing the file headers, I'm pretty sure this gives the
>> file size in bytes / embedded file names at creation point.
>>
>>
>> Phil
>>
>> _______________________________________________
>> Phpwm mailing list
>> Phpwm at mailman.lug.org.uk
>> https://mailman.lug.org.uk/mailman/listinfo/phpwm
>>
>>
>
> -- 
>
> DISCLAIMER:
>
> This document originates from within Dunns Imaging Group Limited.
> This message, together with any associated files, is intended only for
> the use of the individual or entity to which it is addressed and may
> contain information that is confidential, subject to copyright or
> constitutes a trade secret. If you are not the intended recipient of
> this communication you are hereby notified that any dissemination,
> copying or distribution of this message, or of any files associated with
> this message, is strictly prohibited.
> If you have received this message in error, please notify us at once.
>
> Dunns Imaging Group Ltd.
> Registered Office: Chester Road Cradley Heath West Midlands B64 6AA.
> Tel: 01384 564770
> Registered in England 598527.
>
>
> _______________________________________________
> Phpwm mailing list
> Phpwm at mailman.lug.org.uk
> https://mailman.lug.org.uk/mailman/listinfo/phpwm
>


--------------------------------------------------------------------------------



No virus found in this incoming message.
Checked by AVG.
Version: 8.0.101 / Virus Database: 270.4.3/1529 - Release Date: 01/07/2008 
19:23




More information about the Phpwm mailing list