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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.