0

I need some help. : D

I want to create a page where you can upload one or more files after it is uploaded they get the md5 of the file

it must work with files that are on their computer but also files that are already on another server

so if they form a paste in the link text and click on submit, they also get the md5

I hope someone can help and get me a script ore something

Nicolai
  • 133
  • 1
  • 8
  • What is your question? See http://php.net/file-upload and http://php.net/file_get_contents – hakre Aug 31 '13 at 14:49
  • 1
    Have a look at the HTML5 file API, to stop unnecessary uploading with large files. There's some good examples here. http://stackoverflow.com/questions/14733374/how-to-generate-md5-file-hash-on-javascript – Ben Fortune Aug 31 '13 at 14:53

2 Answers2

1

You can't get the md5 of a file from user's computer, but you can get the md5 of a file stored in your server with the md5_file() function.

Usage: md5_file('path/to/file/file.ext');

Daniel-B
  • 111
  • 9
  • that par have i done already but if the file is not on the users computer or on my computer but on a other server how do i get the md5 then without uploading it to my server – Nicolai Aug 31 '13 at 15:01
  • Just pass the link inside that function.. like boen_robot said it should give you the md5. – Daniel-B Aug 31 '13 at 15:04
1

See md5_file().

Just pass the filename of the temporary file ($_FILES['name-of-file-form-field']['tmp_name']) or the HTTP address, and you get exactly the MD5 as a result.

boen_robot
  • 1,450
  • 12
  • 24