Get crc32 checksum of icon.

FromLondon

Honk Honk
TeamSpeak Developer
VIP
May 20, 2016
264
107
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
May 20, 2016
264
107
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
Apr 23, 2016
483
249
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
May 20, 2016
264
107
136
Solved.
For successful calcuting need:
PHP:
$pathIcon="/path/to/icon";
$fileContent=file_get_contents($pathIcon);
$crc32=crc32($fileContent);
 

Some_body

New Member
Mar 27, 2017
30
4
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
May 20, 2016
264
107
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