I want to upload a file by selecting a zip file and passing it to the background php file through ajax. the php file can be obtained using $ _ FILES, but I don't know how to implement it. Although the ghost file is... I want to upload a file by selecting a zip file and passing it to the background php file via ajax. the php file can be obtained using $ _ FILES, but I don't know how to implement it.
I tried to save the zip file by using the following method instead of $ _ FILES.
$input = file_get_contents("php://input",true);file_put_contents('temp/olin.zip',$input);
However, although the resource manager can open the stored olin.zip file normally, there is a problem with the php zip operation. zip_read and close errors will be reported. (The zip file generated by the above two codes can be operated normally)
Ask how to read $ _ FILES, or use php: // input to generate a normal zip file.
Reply content:
I want to upload a file by selecting a zip file and passing it to the background php file through ajax. the php file can be obtained using $ _ FILES, but I don't know how to implement it.
I tried to save the zip file by using the following method instead of $ _ FILES.
$input = file_get_contents("php://input",true);file_put_contents('temp/olin.zip',$input);
However, although the resource manager can open the stored olin.zip file normally, there is a problem with the php zip operation. zip_read and close errors will be reported. (The zip file generated by the above two codes can be operated normally)
Ask how to read $ _ FILES, or use php: // input to generate a normal zip file.
$ Http provided by angularjs cannot be uploaded.
I tried it for a long time. later I used native xhr to succeed. you can refer to the upload instructions in this article.
Angular file Upload command