Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9261613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T13:10:43+00:00 2026-06-18T13:10:43+00:00

I want to have a form, with multiple parts. The first part would be

  • 0

I want to have a form, with multiple parts.

The first part would be images, multiple file upload with a preview of the images before actually uploading them.

The second part has various text form fields.

I have the second part built fine and working, using PHP and MySQL, and the image upload is working too. But I don’t know how to show a preview of the images before submitting the form.

EDIT:

using code form an answer:

     <input type='file' onchange="readURL(this);" />
     <img id="blah" src="#" alt="your image" />

with:

function readURL(input) {
        if (input.files && input.files[0]) {
            var reader = new FileReader();

            reader.onload = function (e) {
                $('#blah')
                    .attr('src', e.target.result)
                    .width(150)
                    .height(200);
            };

            reader.readAsDataURL(input.files[0]);
        }
    }

works great, but it only shows 1 thumbnail. I want to create an image thumbnail dynamically for each file.

I’m trying :

function readURL(input) {
        if (input.files && input.files[0]) {
            var reader = new FileReader();

            reader.onload = function (e) {
          var container = $('#previews');
          var image = $('<img>').attr('src', e.target.result).width(150);
          image.appendTo(container);
            };

            reader.readAsDataURL(input.files[0]);
        }
    }

with:

    <input type='file' name="files[]" onchange="readURL(this);" multiple />
    <div id="previews"></div>

which works, but how do I loop it for each file inputted?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T13:10:44+00:00Added an answer on June 18, 2026 at 1:10 pm

    Take a look at that:

    http://jsbin.com/uboqu3/1/edit

    from this post on stackoverflow:
    Preview an image before it is uploaded

    Lucian

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a php form where multiple images care uploaded. The file names are
I have form with multiple input type=radio with text next to them. I want
I want to have multiple multiple choices given to user after the form submit
I have a form with multiple checkboxes, which I want to put into an
I have a C# form with multiple text boxes. Before proceeding I need to
I have a form with multiple checkboxes and I want to use JavaScript to
I want to create a form using some fields from multiple entities. I have
i have a form with multiple select menus i want to make sure on
I have a form where I am uploading multiple files and there are a
I want to have a form on my page take user input, a URL

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.