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 8165705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:37:18+00:00 2026-06-06T19:37:18+00:00

I have added multiple image upload to my site using HTML api’s. I have

  • 0

I have added multiple image upload to my site using HTML api’s. I have to test each images while uploading, whether they tall (height>width) or long(height

<script type="text/JavaScript">
function filesProcess(files) 
{
  var shape=document.getElementById('shapeval').value;
  for( var i = 0; i < files.length; i++) 
    {
        file = files[i];
        if(!file.type.match(/image.*/)) 
            {


            alert('File name '+file.name+' is not allowed! Please try again!');

            window.location.reload(true);

                continue; //Jump forward to the next file...

                }
      else
        { 
                var iw=document.images[i].width;
            var ih=document.images[i].height;
            var n=document.images[i].name;
            if(shape="tall")
                {

                    alert("width:"+iw+" and height:"+ih);
                }
                else
                {

                    alert("width:"+iw+" and height:"+ih);
                }
            continue;
        }

    }


}
 </script>

HTML

  <form action="upload.php/" method="post" enctype="multipart/form-data" name="uploadForm" onsubmit="return(validate());">
  <input type="file" id="files" name="files[]" multiple  onchange="filesProcess(this.files);" accept="image/*"/>
   <input type="hidden" name="shapeval" id="shapeval" value="tall" />
  </form>

Using this code width and height are displaying, but the value of them are not correct. Most of the time it’s showing 182 and 51 for both type of images; So I couldn’t recognize the images are tall or long? Where I did mistake? Am I missing something?Anyone have any idea??

Thanks!

  • 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-06T19:37:20+00:00Added an answer on June 6, 2026 at 7:37 pm

    As far as I know, you can’t get the height or width of an image you are about to upload thru Javascript. You will need to upload it to the server and then use PHP (or any other server-side scripting language) to get information about the image. Try the PHP function getimagesize(), it should give you the information you need.

    If you’re wanting to process the image inline and kick back information to the user, I would suggest submitting the form with AJAX and using the response data.

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

Sidebar

Related Questions

I have added AJAX Controls. Is it possible to upload multiple files using AsyncFileUpload
I'm building an app where each user can have multiple profiles. Users can upload
I have a problem while trying to upload using plupload and jquery ui dialog
I have added multiple ovals on map view by using below code but I
We presently have Solr deployed across multiple servers on our image sharing site. We
On my site, I have a PHP script which takes multiple source files (HTML,CSS,
I have added a parameter to my report with the option Allow Multiple Values
I have a custom control that can be added multiple times to a form.
I have added some settings to my c# application using the configuration editor. There
I have added multiple labels in My Tableview cell. I am displaying facebook message

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.