This question already has answers here:
Answer
Solution:
Regarding the Strict Standards error on the end
function, from the documentation:
Parameters (1)
array. The array. This array is passed by reference because it is modified by the function. This means you must pass it a real variable and not a function returning an array because only actual variables may be passed by reference.
explode
is a function that returns an array - not a real variable, Since end
modifies real variables, you must set the return value of explode
to a separate real variable and send that variable to end
.
// $url = __dir__.'/siteuploads/'.$_GET["name"].'-musicwala.zip';
foreach($urls[0] as $url)
{
$exploded_array = explode("/", $url);
$name = end( $exploded_array );
// ...
As a guess, the OP's code should actually be foreach ( $urls as $url ){
(not $urls[0]
) but that isn't specifically related to the error code.
The second message: Warning: filesize(): stat failed for..
is a bit harder to diagnose here. Possibly the file wasn't created, maybe it's too large (filesize
can get weird over 2GB files), or some other issue. Try using the following to determine more of an error message (docs here).
var_dump( $zip->getStatusString() ); // Returns a string with the status message on success or false on failure.
var_dump( $zip->close() ); // Returns true on success or false on failure.
Source