I'm using Google app engine 1.9 and I want to unzip a uploaded .zip file using PHP. Since the ZipArchive is not available in App Engine I tried using PclZip (http://www.phpconcept.net/pclzip/) as described in this post
https://code.google.com/p/googleappengine/issues/detail?id=9856
However, once I tried it, I get the following error.
Here, I'm giving the public url of the .zip file. And the url is something like https://my-storage.storage.googleapis.com/folder/my_file.zip (This is not the real url).
"PCLZIP_ERR_MISSING_FILE (-4) : Missing archive file 'https://my-storage.storage.googleapis.com/folder/my_file.zip'"
I also tried changing the url as gs://my-storage/folder/my_file.zip' format and it gives me the following error.
"PCLZIP_ERR_BAD_FORMAT (-10) : Unable to go to the end of the archive 'gs://my-storage/folder/my_file.zip'"
What am I doing wrong here?
Related
I am new to using APIs on laravel. I read through PHP GuzzleHttp, but i couldnt comprehend how to corelate it with ReportingCloud. I am trying to use
ReportingCloud Docs from https://docs.reporting.cloud/docs/chapter/introduction/whatisreportingcloud . Having followed the documentation, on https://docs.reporting.cloud/docs/chapter/introduction/first page shows generation a pdf version of invoice. i still dont get the code behind downloading of the pdf file. I tried checking if my template file exist which shows postive. i try using https://docs.reporting.cloud/docs/endpoint/document/merge on merging data to your template and it works fine.
my problem is how to get those files downloaded on my computer
I'm trying to get a sharepoint file by its path via the graph API. I'm following the example here https://learn.microsoft.com/en-us/onedrive/developer/rest-api/resources/driveitem?view=odsp-graph-online. When I attempt to get the file, I get a resource not found error. I have confirmed that I have access to the files by getting file IDs from the API and then accessing them that way. I need to get them by the path because the file ID is not exposed in sharepoint.
I'm using the URL that is in the address bar when viewing a file in sharepoint. I take that URL and parse it to get the path and pass that along to the the API. Every file I have tried returns the not found message. Am I not using the correct file path? Is there a better way to get the file path out of sharepoint? Is there any other way to get the file without the ID and path? TIA!
I'm using PHP and cURL to make the requests to the API.
My test demo.
MyDoc is a library and has a folder ParentFolder which contains a file report.xlx
/sites/siteid/drives/driveid/root:/ParentFolder/report.xls
I tried to save the file into a specific folder using the following code from a stack overflow thread PHPExcel Save a xls file to a specific folder
$objWriter->save(str_replace(__FILE__,'folder_path/filename.xlsx',__FILE__));
Since I am using yii 2 I tried this method
$objWriter->save(str_replace(__FILE__,Yii::getAlias('#web') .'/files/MyContacts.xlsx',__FILE__));
But it is not working the file still creates in the web (root folder). Is there a solution for the same ?
The error message i get is "Could not close zip file" (i am using a Windows Operating System)
Yii::getAlias('#web') returns URL of web application but for saving a file you need path of web application so try \Yii::getAlias('#webroot') instead.
I'm using Filepicker.io to upload PDFs to my application. I have all those URLs and now I am trying to merge some of those PDFs using the PDF Tool Kit PHP library. It was not working for me so I ran some tests using the "file_exists" on PHP and it kept returning false.
I think this has to do with the fact that the URL does not have a ".pdf" extension at the end. This is what they look like: "https://www.filepicker.io/api/file/LCvbgpqEQLGwt8bfnqc1"
Does anyone know how I can pull the PDF using PHP in order to merge those files using the PDF Toolkit Library?
Thanks!
Alain F.
file_exists doesn't work with URLs, only with local files. Instead download the file to the temp dir using the copy command.
If the file can't be downloaded, the copy command will return false.
$exists = copy('https://www.filepicker.io/api/file/LCvbgpqEQLGwt8bfnqc1', '/tmp/example.pdf');
if (!$exists) throw new Exception("PDF could not be downloaded");
Use the downloaded file in the PDF Tool Kit.
EDIT: This does not solve this particular problem but does address the theory that it didn't work because "the URL does not have a ".pdf" extension at the end."
You can add things to the end of the filepicker URL with a trailing +
The following urls are equivalent:
https://www.filepicker.io/api/file/LCvbgpqEQLGwt8bfnqc1
https://www.filepicker.io/api/file/LCvbgpqEQLGwt8bfnqc1+name.pdf
Im currently working on a cms, and building an ajax / php remote updater script. The cms files are located on Github, and im using the API to get the file changes and source of those changes. As you can see here: https://api.github.com/repos/Plexis/Plexis/commits/116743cefde6765a4d4a8d0558bd17c4908dd586
Under "files" it lists all the changed files. The problem is, renamed / moved files. I cant seem to get a solid idea of how to get the original file so i can unlink it with php. If i try to get all the trees, that can take a ajax request per directoy... That's just too much. Anyone have an idea where i can get the source file's name and location before it was renamed / moved?
Might ask your changes as you're doing now, then for new files do not exist or could you try
https://api.github.com/repos/{user}/{repo}/commits?path={file.path}
for get her history. You can try with the hast too, the hash is the same event if the file has a diferent name