Jump to content

download zip file for mac


homer.favenir

Recommended Posts

hi,

i have a web app with script that download zip file.

i trie to use it in Mac, i downloaded a zip file, and it is successful.

but when i unzip it, it has an error "Error -1 Operation not Permitted"

i copy the zip file to pc and it unzipped successfully, so the file is not corrupted.

i think the problem is in the downloading process.

 

heres my code

function GetArticle($strSourceAbsoluteFilePath,$artid)
{
	$retVal =  FALSE;



	if ((!isNullorEmpty($strSourceAbsoluteFilePath)) &&  (!isNullorEmpty($_SESSION['userid'])) )  
	{
		$artid = str_replace(".zip","",$artid);

		if ((ReturnArticleOwner($artid) == $_SESSION['userid']) && (IsArticleAssigned($artid)) && (file_exists($strSourceAbsoluteFilePath)))
		{
				//OKAY sa kanya to and its not yet assigned
				header("Content-Type: application/zip");
				header("Content-Disposition: attachment; filename=" . basename($strSourceAbsoluteFilePath));
				//$retVal = readfile($strSourceAbsoluteFilePath);
				$retVal = readfile_chunked($strSourceAbsoluteFilePath,TRUE);

		}
		else //<-dont forget!
		{
				die("Invalid attempt to download article.");
		}

	}
	return $retVal;
}

 

TIA

Link to comment
https://forums.phpfreaks.com/topic/174564-download-zip-file-for-mac/
Share on other sites

sometimes the file is partially corrupted but it still works. Try downloading your file using Chrome Browser. additionally, try editing the zip file using notepad (right-click on it -> open with -> choose text editing program). If you get any text that you can understand (mostly HTML) then the file is currpoted and there is something wrong with the downloading process.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.