comparison mod_http_upload_external/share.php @ 4310:b0ad1604f77e

mod_http_upload_external: update php scripts to return HTTP 201 Created on upload
author Richard Schwab <hgprosodyim-lawrpxz9uw@central-intelligence.agency>
date Mon, 21 Dec 2020 19:29:04 +0100
parents 62c82d097017
children
comparison
equal deleted inserted replaced
4309:e8b9228b5265 4310:b0ad1604f77e
111 } 111 }
112 112
113 /* Close the streams */ 113 /* Close the streams */
114 fclose($incoming_data); 114 fclose($incoming_data);
115 fclose($store_file); 115 fclose($store_file);
116
117 // https://xmpp.org/extensions/xep-0363.html#upload
118 // A HTTP status Code of 201 means that the server is now ready to serve the file via the provided GET URL.
119 header('HTTP/1.0 201 Created');
120 exit;
116 } else if($request_method === 'GET' || $request_method === 'HEAD') { 121 } else if($request_method === 'GET' || $request_method === 'HEAD') {
117 // Send file (using X-Sendfile would be nice here...) 122 // Send file (using X-Sendfile would be nice here...)
118 if(file_exists($store_file_name)) { 123 if(file_exists($store_file_name)) {
119 header('Content-Disposition: attachment'); 124 header('Content-Disposition: attachment');
120 header('Content-Type: application/octet-stream'); 125 header('Content-Type: application/octet-stream');