This gives users ability to clone any file links from site to their own account.
Very usefull function to avoid same files re-uploading by users.
Thanks!
Very usefull function to avoid same files re-uploading by users.
Thanks!
It's entirely possible, the issue comes when calculating the hash. For large files it can take a huge amount of time if done in the clients browser. The script already wont store duplicate files, so storage isn't the benefit of this, bandwidth usage would be though.ruslan5467 said:+1
Virustotal also works like this.
1. client side calculate file hash BEFORE upload file and send it to server side.
2. server side chech hash
3. a) if file exist it just copy file link to new owner and reply to client side that no need to upload file. It is weldone.
b) oterwize start file uploading.
All recent file hosting software uses this algorythm in uploading files. China cloud systems, russian ones, european and others. They save up to 40% of storage and income traffic.
This feature is usefull and is highly desirable.
It would take long to calculate the md5 in the client but it will be always faster than upload the file. The script may check the md5 while another thread uploads the file. If the md5 matches some file in the server, the upload is canceled. In my tests using the script that I sent you via tickets my 5 years old laptop took 10 seconds to calculate the md5 of a 200mb file using 50% of the cpu. I added a setTimeout function to reduce the cpu usage.adam said:It's entirely possible, the issue comes when calculating the hash. For large files it can take a huge amount of time if done in the clients browser. The script already wont store duplicate files, so storage isn't the benefit of this, bandwidth usage would be though.ruslan5467 said:+1
Virustotal also works like this.
1. client side calculate file hash BEFORE upload file and send it to server side.
2. server side chech hash
3. a) if file exist it just copy file link to new owner and reply to client side that no need to upload file. It is weldone.
b) oterwize start file uploading.
All recent file hosting software uses this algorythm in uploading files. China cloud systems, russian ones, european and others. They save up to 40% of storage and income traffic.
This feature is usefull and is highly desirable.
I've had a few people ask if there's anything that can be done here so we'll take a look for the next release. It may be that we initially just do it with files less than say 100MB with the option to increase it in the admin area. Or store a hash of the first 100MB and use this for the checking, but there's a (slight) chance the first 100MB of a larger file would be the same as another different file.
Maybe a check on the filesize & 100MB hash would do it?
dd if=/dev/urandom of=100mp.test bs=1024 count=102400
Can do the trick and save alsa a time to calculate hash for big files. But I suppose to complicate your method.Maybe a check on the filesize & 100MB hash would do it?