Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Uploading an ftp site
Message
From
23/08/2008 03:25:37
 
 
To
23/08/2008 02:14:53
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01341138
Message ID:
01341298
Views:
20
This message has been marked as a message which has helped to the initial question of the thread.
>Just to tell what I was told to do and my doubts about that :
>In this one opinion I should better (i'm talking about the client side) check if there is something new to download on the ftp server, then get the size of the file to download, wait a bit of time say 4-5 seconds and check the file size again, if it is the same it would mean that the file was completely uploaded and I can proceed to download it , on the contrary i should have to wait till its size does not change.... In my opinion the first solution is the better ( i mean to rename the file to its final name just after it is completely upload)
>What do you think ?
>
>>Hi all,
>>I want to know which is the best way to proceed to an upload on a ftp server :)
>>What i want to avoid is the evenutality that a client start to download a file before it was completely uploaded by the server.
>>
>>Say i have the myfile.ext to be uploaded on the ftp by a server and that i have a client which downloaded it if it is available
>>Actually I upload the file calling it myfile.ext.tmp and as soon i complete the upload i reneme it in myfile.ext
>>Is it correct? someone told me it took a loto of time to the ftp server and it is not safe anyway
>>
>>Thank you
___
Alessio,


It's very simple. On the ftp server you also put a file which contains an md5 hash of the file
If you upload, you upload the file, calculate its md5 hash and put that in a separate file on the server

When you download (you can use InternetOpenUrl and InternetReadFile instead of ftp) you calculate the md5 hash. After file dowload get the md5 hash from the server and compare the two. If they do not match then there's a problem with the transmission over internet, you were in the middle of uploading, virus, ... and you can retry the download


Note: You can also retrieve the filesize of a file opened with InternetOpenUrl using HttpQueryInfo().


To calculate an md5 hash - needs windows 2000 or Xp http://www.atoutfox.com/articles.asp?ACTION=FCONSULTER&ID=0000000627

ps: I prefer InternetOpenUrl() and InternetReadFile(). You do not need any password to download
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform