SFTP File Upload - Data Integrity

Get help with using the PHP Secure Communications Library.

Moderator: Nuxius

Forum rules
The purpose of this forum is to provide support for phpseclib, a pure PHP SSH / SFTP / RSA library.

Posts by new users are held in a moderation queue and are not publicly visible until the post is approved.

SFTP File Upload - Data Integrity

Postby theanimalix » Fri Oct 18, 2013 3:43 pm

I'm trying to verify data integrity after uploading a file with "put" command.
Code: Select all
$sftp->put($remote_file, $local_file, NET_SFTP_LOCAL_FILE);


I've tried to use MD5, and it works OK if I upload file to my local server and compare MD5s, but the MD5 string is different after uploading file to a remote server. Aren't they supposed to stay the same?

Is there any other solution to verify that the file was uploaded successfully, without data loss?
theanimalix
Traveler
 
Posts: 11
Joined: Sun Oct 13, 2013 7:56 pm

Re: SFTP File Upload - Data Integrity

Postby TerraFrost » Fri Oct 18, 2013 5:35 pm

That would be my expectation.

How big is the file that's being uploaded and how big is it after it's been uploaded?
TerraFrost
Legendary Guard
 
Posts: 12357
Joined: Wed Dec 04, 2002 6:37 am

Re: SFTP File Upload - Data Integrity

Postby theanimalix » Fri Oct 18, 2013 6:21 pm

The file I was uploading is public key, so it's small, 1Kb , and the size and content is the same on both computers.
theanimalix
Traveler
 
Posts: 11
Joined: Sun Oct 13, 2013 7:56 pm

Re: SFTP File Upload - Data Integrity

Postby TerraFrost » Fri Oct 18, 2013 6:29 pm

That makes debugging easier then lol.

Can you post the orig and the uploaded one as attachments to this forum?

Thanks!
TerraFrost
Legendary Guard
 
Posts: 12357
Joined: Wed Dec 04, 2002 6:37 am

Re: SFTP File Upload - Data Integrity

Postby theanimalix » Sun Oct 20, 2013 1:25 pm

Today when I started to work on this project I found out that md5 works as it should, and I couldn't get it to not work, so I'm not sure what the problem was...I guess I had something set up wrong here, so I'm really sorry to bug you here.

Thanks again for all the help and good luck with the project.
theanimalix
Traveler
 
Posts: 11
Joined: Sun Oct 13, 2013 7:56 pm


Return to phpseclib support

Who is online

Users browsing this forum: No registered users and 1 guest

cron