View Single Post
Old 23rd June 2010, 14:52   #11
Grytolle
Junior Member
 
Join Date: Jun 2010
Posts: 9
Yes

Edit: here's my solution

Create a new php file in the same folder as the file that is to be downloaded:
code:
<?php
$totalsize=0;
$zip = zip_open($saveToDir."something.zip");
while($z = zip_read($zip)) {
$totalfilesize += zip_entry_filesize($z);
}
zip_close($zip);
echo "UnzippedLength: ".$totalfilesize;
?>



Modified code to retrieve the generated string by the php-file:
code:
!addplugindir "."
RequestExecutionLevel user
OutFile "content-length_test.exe"

Section
NSISdl::download_quiet "YOUR URL.php" "$EXEDIR\filesize-za.txt"
Pop $0
StrCmp $0 "success" _ok
MessageBox MB_OK "Could not download."
goto _end
_ok:
StrCpy $R0 -1
FileOpen $0 "$EXEDIR\filesize-za.txt" "r"
_nextline:
ClearErrors
FileRead $0 $1
IfErrors _closeFile
StrCpy $2 $1 16
StrCmp $2 "UnzippedLength: " _found _nextline
_found:
StrCpy $R0 $1 "" 16
goto _closeFile
_closeFile:
FileClose $0
IntOp $R0 $R0 / 1024 ;bytes -> kilobytes
MessageBox MB_OK "retrieved unzipped size: $R0 KB"
Delete "$EXEDIR\filesize-za.txt"
_end:
SectionEnd


Last edited by Afrow UK; 24th June 2010 at 20:04. Reason: Adding solution; removed duplicate zip_entry_filesize() call
Grytolle is offline   Reply With Quote