Welcome to Dream.In.Code
Getting PHP Help is Easy!

Join 132,119 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 2,017 people online right now. Registration is fast and FREE... Join Now!




Verify an uploaded file

 
Reply to this topicStart new topic

Verify an uploaded file, Need help in uploading files.

silverblaze
post 23 May, 2008 - 09:37 AM
Post #1


D.I.C Head

**
Joined: 18 Jan, 2008
Posts: 51



Thanked 3 times
My Contributions


Hello all,

I am currently working on a file hosting site. I like to ad a file verification system into it.

What exactly i want to do is, After uploading a file i have to verify whether the uploaded file has some errors while uploading. i mean wheather the file got corupted while uploading. In other words i want to check the uploaded file against the orginal file.

Is their any way to do it?

I am uploading the file with CGI and the file will be in the default temp dir and from their i will move it to the files dir using php. If their is a way to verify whr is the best place to do it, while the files are at temp dir or after moving it to the files dir?

Thankyou,

Regards,
Anush.
User is offlineProfile CardPM

Go to the top of the page

akozlik
post 23 May, 2008 - 10:10 AM
Post #2


D.I.C Addict

Group Icon
Joined: 25 Feb, 2008
Posts: 587



Thanked 22 times

Dream Kudos: 750
My Contributions


QUOTE(silverblaze @ 23 May, 2008 - 10:37 AM) *

Hello all,

I am currently working on a file hosting site. I like to ad a file verification system into it.

What exactly i want to do is, After uploading a file i have to verify whether the uploaded file has some errors while uploading. i mean wheather the file got corupted while uploading. In other words i want to check the uploaded file against the orginal file.

Is their any way to do it?

I am uploading the file with CGI and the file will be in the default temp dir and from their i will move it to the files dir using php. If their is a way to verify whr is the best place to do it, while the files are at temp dir or after moving it to the files dir?

Thankyou,

Regards,
Anush.


Hello again,

Read up on how to to do checksums. Checksums are basically a way to verify the integrity of data, and especially files. You'll see that most sites that offer file downloads have a checksum that can be used to verify the integrity. I'm not going to go into crazy details because there is way too much to go over, but you can start by reading this tutorial. All you need to do is adapt everything to php. You could also try googling 'php checksum' and see what comes up.

Hope all that helps. Take care.
User is online!Profile CardPM

Go to the top of the page

silverblaze
post 23 May, 2008 - 10:43 AM
Post #3


D.I.C Head

**
Joined: 18 Jan, 2008
Posts: 51



Thanked 3 times
My Contributions


hey akozlik thanks for the tip. i am pretty sure tht i can convert and create a chechsum in php. Actually speaking i had learned a lot about this checksum and error corrections in my 4th semester.( i am doing my final year Btech in Information Technology). So i can surly convert this.

But i am not getting any idea's poped up on how to get the checksum of the orginal file at client side. what i am able to do now is i can check the checksum of the temp file and the uploaded file. but what i want is to check the integrity of orginal file in our disk with the one on our server. Can you please point me to wht can i possibly do. In the mean time i will create a chechsum function and will post it 2mmro as i am a bit busy with another work today.

Edit: i just found that their is 2 functions i can use in php .. hash_file and crc32. http://in2.php.net/crc32 ..

thankyou.

takecare...

This post has been edited by silverblaze: 23 May, 2008 - 10:51 AM
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/21/08 10:50AM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month