I have a rather simple app in .net which uploads images in fixed intervals in an ftp server.

The file name is specific.

I need to have a web page that refreshes but i want this to happen only when the upload finishes.

How i find a way to determine that the upload has finished? And if the solution has to do with renaming and deleting temp files, should i do this from the windows app or server side?


update: What if i could find a way to check if a filename is a valid jpg? I mean if the transfer is not over this check should return false..ideas?

1 Answer 1


JPEG files use a marker 0xFF 0xD9 to indicate end of image. If that marker is not present in the file, either the upload failed or did not yet finish. Scanning the file for this marker should be sufficient to check for incomplete upload.

This won't however detect any corruption within the image data itself. A way to ensure the integrity of the data would be to generate a CRC checksum before the upload in the desktop app, pass the checksum to the ftp (in the image filename or a separate file) and then compare the checksum of the uploaded file in the server-side code.

This assumes the web app would attempt to autonomously update in fixed intervals. Alternatively you could use a webservice or a dummy page to trigger the update from the desktop app.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.