logo
down
shadow

How to get response while uploading multiple images


How to get response while uploading multiple images

Content Index :

How to get response while uploading multiple images
Tag : javascript , By : cthulhup
Date : November 29 2020, 12:01 PM

wish helps you I've been struggling to get the response when i am uploading multiple images.The API is supposed to send me some response.(However,on uploading a single image,I am getting a valid response.) Here is the code: , Try putting a response variable inside the callback.
axios.all(uploaders).then((response) => {

 console.log("All images uploaded", response)

});

Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

Creating thumbnail images while uploading multiple images with php


Tag : php , By : yew tree
Date : March 29 2020, 07:55 AM
it helps some times I tried a simple thumbnail script found on this tutorial and it worked perfectly: http://net.tutsplus.com/articles/news/how-to-dynamically-create-thumbnails/
for your suggestions

All images not uploading in multiple images upload


Tag : php , By : clifton anderson
Date : March 29 2020, 07:55 AM
this will help In the loop you have checked $error[]. So when the error is in first file so that array will not be blank and other images will not upload.
Try as below :
function filesupload($files) // here files is $_FILES array
{
    $i = 0;
    $errors = array();
    $maxfilesize = 1*1024*1024; // 1 MB
    $num = count($files['name']);

    $allowed_types = array('image/jpeg', 'image/png');

    foreach($files['tmp_name'] as $key=>$tmp_name)
    {
        $tmpname = $files['tmp_name'][$key]; // file temp name
        $fsize = $files['size'][$key];  // file size

        if(!empty($files['name'][$key]))
        {
            $finfo = finfo_open(FILEINFO_MIME_TYPE);
            $ftype = finfo_file($finfo, $files['tmp_name'][$key]); // file mime type
        }

        //validations for file type and size

        // no file selected
        if(empty($files['name'][$key]))
        {
            $errors[$key] = 'Select at least one file for uploading';
        }

        // file type not allowed
        if(in_array($ftype, $allowed_types) === false)
        {
            $errors[$key] = 'One or more files have invalid file extension';
        }

        // file size validation
        if($fsize > $maxfilesize)
        {
            $errors[$key] = 'Size of one or more files is more than allowed';
        }

        // if no errors uploaded file(s)
        if(!isset($errors[$key]))
        {
            $path = 'images/';
            $newfilename = time().'_'.rand(100000, 999999).'_'.$files['name'][$key];
            $move = move_uploaded_file($tmpname, $path.$newfilename);
            if($move)
            {
                $i = $i + 1;
                if($i == $num)
                {
                    $msg = 'Files uploaded';
                    return $msg;
                }
            }
        }
    }

    if(!empty($errors))
    {
        return $errors;
    }
}

showing images while uploading multiple images


Tag : angularjs , By : Brianna
Date : March 29 2020, 07:55 AM
it should still fix some issue To display currently selected file you could read it using FileReader API and provided that base64 string inside img src.
HTML
<input type="file" file-upload /> {{files.length}}
<div ng-repeat="step in files">
  <img ng-src="{{step.src}}" />{{step.src}}
</div>
$scope.$on("fileSelected", function(event, args) {
  var item = args;
  $scope.files.push(item);
  var reader = new FileReader();

  reader.addEventListener("load", function() {
    $scope.$apply(function() {
      item.src = reader.result;
    });
  }, false);

  if (item.file) {
    reader.readAsDataURL(item.file);
  }
});

How I will show multiple video's , images? When I am uploading multiple images and vieos


Tag : ios , By : eastcoastj
Date : March 29 2020, 07:55 AM
To fix the issue you can do You can use SizeForItemAt function to set custom sizes for each cell and add a button inside the last cell to open the last two images or use didSelectItemAt to open the last cell.
func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize
{
      var collectionViewSize = collectionView.frame.size
   if indexPath.row == 0 {
      collectionViewSize.width = collectionViewSize.width/2.0 //Display 2 items in a row.
      collectionViewSize.height = collectionViewSize.height/2.0
     }
 if indexPath.row == 1 {

  collectionViewSize.width = collectionViewSize.width/3.0 //Display 3 items in row
  collectionViewSize.height = collectionViewSize.height/2.0
  }
      return collectionViewSize
}





 func collectionView(_ collectionView: UICollectionView,    numberOfItemsInSection section: Int) -> Int {
     return yourImageArray.count
}



   func collectionView(_ collectionView: UICollectionView, cellForItemAt    indexPath:  IndexPath) -> UICollectionViewCell {
 let cell =  collectionView.dequeueReusableCell(withReuseIdentifier: "YourCustomCell", for: indexPath) as! YourCustomCell 
cell.imageView.image = yourImageArray[indexPath.item] as UIImage
return cell 
}

uploading multiple images in angular with preview including names of images


Tag : angular , By : MikeW
Date : March 29 2020, 07:55 AM
wish help you to fix your issue with uploading images in angular 8, I need to preview the images with name of each image under it, preview done successfully and the name under image appeared but of other image not of the same one, so names are disordered with sequential of images. , This code is Working
HTML:
   <input class="btn btn-secondary" type="file" name="image" (change)="fileProgress($event)" multiple="multiple" />

    <div class=" row" *ngIf="show_preview">
        <div class=" col-md-2 pr-md-1">
            <div class="image-preview mb-3" *ngFor=" let j of previewUrl">
                <img [src]="j.url" height="100" />
                <div >
                    <h6 style="text-align: center">{{j.imageName }}</h6>
                </div>
            </div>
        </div>
    </div>
fileProgress(fileInput: any) {
    this.fileData = new Array<File>();
    this.number_list = new Array<number>();
    this.previewUrl = new Array<string>();
    this.file_names = new Array<string>();
    this.image = new Array<typeof Image>();
    console.log("after formating", this.previewUrl)//to check
    for (this.i = 0; this.i < fileInput.target.files.length; this.i++) {
      this.preview(fileInput.target.files[this.i]);
    }
    this.show_preview = true;
  }

  preview(file: any) {
    var reader = new FileReader();
    reader.readAsDataURL(file);
    reader.onload = (_event: any) => {
      this._img = new Image();
      this._img.name = file.name;
      this.image.push(this._img);
      const obj = {
        url: _event.target.result,
        imageName: this._img.name
      }
      this.previewUrl.push(obj);
      console.log('this.previewUrl', this.previewUrl);
    }
  }
Related Posts Related QUESTIONS :
  • How To Track Outbound Clicks Using Javascript
  • How to get total seconds elapsed since the beginning of the month?
  • Protractor: Stale element reference at "browser.wait(EC.visibilityOf(confDial), FIFTY_SECONDS);"
  • Access to an array inside an object
  • Reseting an JavaScript Interval with different value?
  • Learning Angular for the first time - version 2 or 4?
  • Rendering RSS feed (XML) in React with jquery, why do object values parsed from the feed seem empty?
  • Node.js xml2js http.request tag matching
  • applying texture to custom plane geometry in Threejs
  • How do I pass an Event as a function parameter in HTML written inside JavaScript variable?
  • Interface of object parameter with default value and default property
  • Does using try / catch rather than `.catch` observable operator with XHR requests reduce performance?
  • In IE11 background colors not working on printing
  • TypeScript interface signature "(): string"
  • Is synchronous XMLHttpRequest supported in Internet Explorer 10 and 11?
  • Axios function not returning any values with js
  • How to use firestore TIMESTAMP to create time-stamp in JavaScript
  • Instantiate subclass without constructing
  • Outputing a created object in javascript to a server side JSON file
  • Transition the numeric labels in a bar chart
  • createBottomTabNavigator: hide just one tab from the tabBar
  • iife vs simple statement behavior with document.title
  • showDialogPopup Refresh Page after Click
  • Child component does not set the initial value passed from the parent: ReactJS
  • Nodejs javascript added to button not responding
  • Trying to define a promise.all
  • Python GEE to extract featurecollection timeseries from Landsat imageries
  • How to write negative binary number?
  • Unable to set property of individual object
  • Why Named Function Expression itself cannot assign Name to another Value?
  • How to reset scroll position on single page pagination
  • How to scroll to bottom of page, when a new message is sent - Socket.io
  • How to reconstruct audio blob from a base64 encoded String?
  • How to calculate numbers within an array of objects
  • Using JavaScript to change CSS properties of SVG circles for all circles that was not clicked
  • Is there value in propTypeing repeat required properties at every level of nested components?
  • Call function if variable does not exist in a filter
  • localStorage value doesn't get updated automatically
  • React not updating state with setState correctly inside promises
  • Direct native JavaScript or jQuery method to get containing block of an element
  • Dynamic JSON object to Html Table
  • How to send Id and file to same controller?
  • How to Make a jQuery Table Cell(td) clickable to Run a Function?
  • Prevent the duplicate function onchange event jQuery
  • Reactjs Input Upload doesn't return local URL
  • An unexpected 'StartObject' node was found when reading from the JSON reader. A 'PrimitiveValue' node was expected
  • How to filter a JSON Array, with an eventListener input value at keyup
  • How to separate the different properties of filter in css?
  • Why dont work change event of bootstrap input spinner?
  • How to hide overflow text content in react
  • Is there another way to write line 6
  • Cypress - how to find by text content?
  • How to setstate for the dynamic checkboxes in a loop in react?
  • Is display:none safe?
  • How to create a form to change part of a href url of a button?
  • Put many function inside function in Javascript
  • how to exit from loop after a ajax call
  • Do Angular Reactive Form Validator.min/max check Perform Type Conversions before checking the value?
  • How to Replace Text Within Script Tags Using JQuery
  • add variable to object if not undefined using short-hand
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com