I want to upload a file, select a zip file, and pass it to the background php file through ajax. The php file can use $_FILES to get the file, but I don’t know how to implement it.
I tried not using $_FILES before, but using the following method to save the zip file
<code>$input = file_get_contents("php://input",true); file_put_contents('temp/olin.zip',$input);</code>
However, although the saved olin.zip file can be opened normally in the resource manager, there is a problem with the zip operation of php. Both zip_read and close will report errors. (The zip file generated without the previous two lines of code can operate normally)
Please tell me how to read $_FILES, or use php://input to generate a normal zip file.
I want to upload a file, select a zip file, and pass it to the background php file through ajax. The php file can use $_FILES to get the file, but I don’t know how to implement it.
I tried not using $_FILES before, but using the following method to save the zip file
<code>$input = file_get_contents("php://input",true); file_put_contents('temp/olin.zip',$input);</code>
However, although the saved olin.zip file can be opened normally in the resource manager, there is a problem with the zip operation of php. Both zip_read and close will report errors. (The zip file generated without the above two lines of code can operate normally)
Please tell me how to read $_FILES, or use php://input to generate a normal zip file.
The $http that comes with angularjs cannot be uploaded.
I tried it for a long time, and then I succeeded using native xhr. You can read the upload instructions in this article for the specific process.
angular file upload command