Get crc32 checksum of icon.

FromLondon

Honk Honk
TeamSpeak Developer
VIP
Joined
May 20, 2016
Messages
264
Reaction score
107
Points
136
Hello, i`m writing icon download/upload script with logging and copying downloaded icon in folder for backups.
And have problem, how to calculate crc32 checksum of downloaded icon ?
Each time getting different values, but after downloading icon in ts i see equally value of crc32 checksum.
 

FromLondon

Honk Honk
TeamSpeak Developer
VIP
Joined
May 20, 2016
Messages
264
Reaction score
107
Points
136
Yes, using php
Some code:
PHP:
if (isset($_POST['send_icon'])){
    $fileName=$_FILES["icon"]["name"];
    $fileSize=(float) (($_FILES["icon"]["size"]) / 1024);
    $fileCRC32=crc32($_FILES["icon"]["tmp_name"]);

Each time get different values of crc32)
 

Najsr

Moderator
TeamSpeak Developer
Joined
Apr 23, 2016
Messages
483
Reaction score
249
Points
167
Yes, using php
Some code:
PHP:
if (isset($_POST['send_icon'])){
    $fileName=$_FILES["icon"]["name"];
    $fileSize=(float) (($_FILES["icon"]["size"]) / 1024);
    $fileCRC32=crc32($_FILES["icon"]["tmp_name"]);

Each time get different values of crc32)
Isn't your 'tmp_name' changing? You should get crc from whole file not just name.
 

FromLondon

Honk Honk
TeamSpeak Developer
VIP
Joined
May 20, 2016
Messages
264
Reaction score
107
Points
136
Isn't your 'tmp_name' changing? You should get crc from whole file not just name.
Oh, yes, tmp_name os changing.
Will calculate with ready file.
 

FromLondon

Honk Honk
TeamSpeak Developer
VIP
Joined
May 20, 2016
Messages
264
Reaction score
107
Points
136
Isn't your 'tmp_name' changing? You should get crc from whole file not just name.
Every time different crc32. Can send code in pm, if you need
 

FromLondon

Honk Honk
TeamSpeak Developer
VIP
Joined
May 20, 2016
Messages
264
Reaction score
107
Points
136
Solved.
For successful calcuting need:
PHP:
$pathIcon="/path/to/icon";
$fileContent=file_get_contents($pathIcon);
$crc32=crc32($fileContent);
 

Some_body

New Member
Joined
Mar 27, 2017
Messages
30
Reaction score
4
Points
20
Solved.
For successful calcuting need:
PHP:
$pathIcon="/path/to/icon";
$fileContent=file_get_contents($pathIcon);
$crc32=crc32($fileContent);
Can I by this script upload icon from web to TS3 Server and return id of the icon ? If yes could you give me the full code :rolleyes:
 

FromLondon

Honk Honk
TeamSpeak Developer
VIP
Joined
May 20, 2016
Messages
264
Reaction score
107
Points
136
Can I by this script upload icon from web to TS3 Server and return id of the icon ? If yes could you give me the full code :rolleyes:
Id of icon it is crc32 checksum)
Yes, you can download icon.
Rewrite in presentable appeareance for you (because i`m writing for my purposes)
 
Top