Skip to content

Commit

Permalink
multiple-photos
Browse files Browse the repository at this point in the history
  • Loading branch information
pavlosb committed Apr 17, 2024
1 parent fc796ba commit 8cf42fe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion application/controllers/Inspection.php
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,9 @@ public function photoupload(){


public function imgupload(){

for($i=0;$i<count($_FILES["file"]["name"]);$i++)
{
/* Get the name of the uploaded file */
$filename = str_replace(' ', '_', $_FILES['file']['name']);

Expand All @@ -930,8 +933,9 @@ public function imgupload(){

/* Save the uploaded file to the local filesystem */
if ( move_uploaded_file($_FILES['file']['tmp_name'], $location) ) {
$url = 'https://' . $_SERVER['HTTP_HOST'] .'/upload/' . $filename;
$url[] = 'https://' . $_SERVER['HTTP_HOST'] .'/upload/' . $filename;
}
}
$response['url'] = $url;

echo json_encode($response);
Expand Down
2 changes: 1 addition & 1 deletion application/views/inspectionform.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ function uploadFile() {
i = i+1;
let formData = new FormData();
//if(fileupload.files[0].length > 0) {
formData.append("file", fileupload.files[0]);
formData.append("file", fileupload.files);

$.ajax({
url:'/inspection/imgupload',
Expand Down

0 comments on commit 8cf42fe

Please sign in to comment.