stable

Clone or download

Read-only

Be able to upload th file which will be used to create the new project

To test you can use the following snippet: ``` <input type="file" id="myfile"> document.getElementById('myfile').addEventListener('change', async (e) => { const file = e.target.files[0]; const post_response = await fetch(`/api/project_files`, { method: 'POST', credentials: 'same-origin', headers: { "Content-Type": "application/json", }, body: JSON.stringify({ file_name: file.name, file_size: file.size }) }); const post_response_body = await post_response.json(); const upload_href = post_response_body["upload_href"]; // Create a new tus upload const upload = new Upload(file, { uploadUrl: upload_href, retryDelays: [0, 3000, 5000], metadata: { filename: file.name, filetype: file.type }, onError: function (error) { console.log("Failed because: " + error); }, onProgress: function (bytesUploaded, bytesTotal) { const percentage = (bytesUploaded / bytesTotal * 100).toFixed(2); console.log(bytesUploaded, bytesTotal, percentage + "%"); }, onSuccess: function () { console.log(" %s uploaded to %s", upload.file.name, upload.url); alert('Done'); } }); // Start the upload upload.start(); }); ``` The result will be displayed in the web console. When the file is uploaded, it should be in: `/var/tmp/project/ongoing-upload/` Part of story #36484 create a new project from an XML template Change-Id: Ibc194fe86d695bdf6f7b02774e981f494d1283d1

Modified Files

Name
A src/common/Project/Registration/CheckProjectRegistrationUserPermission.php +37 −0 Go to diff View file
M src/common/Project/Registration/ProjectRegistrationUserPermissionChecker.php +3 −8 Go to diff View file
A src/common/Project/Registration/Template/Upload/DeleteFileUpload.php +30 −0 Go to diff View file
M src/common/Project/Registration/Template/Upload/FileOngoingUploadDao.php +20 −1 Go to diff View file
A src/common/Project/Registration/Template/Upload/SearchFileUpload.php +30 −0 Go to diff View file
A src/common/Project/Registration/Template/Upload/Tus/FileOngoingUploadInformation.php +42 −0 Go to diff View file
A src/common/Project/Registration/Template/Upload/Tus/ProjectFileBeingUploadedInformationProvider.php +106 −0 Go to diff View file
A src/common/Project/Registration/Template/Upload/Tus/ProjectFileDataStore.php +69 −0 Go to diff View file
A src/common/Project/Registration/Template/Upload/Tus/ProjectFileUploadCanceler.php +44 −0 Go to diff View file
A src/common/Project/Registration/Template/Upload/Tus/ProjectFileUploadFinisher.php +39 −0 Go to diff View file
M src/common/Request/RouteCollector.php +45 −0 Go to diff View file
A tests/unit/common/Project/Registration/CheckProjectRegistrationUserPermissionStub.php +57 −0 Go to diff View file
A tests/unit/common/Project/Registration/Template/Upload/DeleteFileUploadStub.php +48 −0 Go to diff View file
A tests/unit/common/Project/Registration/Template/Upload/SearchFileUploadStub.php +50 −0 Go to diff View file
A tests/unit/common/Project/Registration/Template/Upload/Tus/ProjectFileBeingUploadedInformationProviderTest.php +143 −0 Go to diff View file
A tests/unit/common/Project/Registration/Template/Upload/Tus/ProjectFileUploadCancelerTest.php +72 −0 Go to diff View file
A tests/unit/common/Project/Registration/Template/Upload/Tus/ProjectFileUploadFinisherTest.php +41 −0 Go to diff View file