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

  • Home
  • SEARCH
  • 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 8812425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:36:12+00:00 2026-06-14T03:36:12+00:00

I am unable to upload files using html control. lets suppose i have two

  • 0

I am unable to upload files using html control.

lets suppose i have two image files
image1.jpg and image2.jpg

image1 gets uploaded
image2 doesn’t

Everything is fine with image1 ,the same code gets called for image2 but image2 is not uploaded.
It is not giving any error.

There is no upload restriction like file size and/or extension.
I have also changed the php.ini with changes in maxpostsize,uploadsize and memory limit.
Please help out, I have been searching this thing for three days but never got the reply.

if(isset($_POST['submitBtn']))
{
$title=$_POST['titleTxt'];
mysql_query("INSERT into tblsliderphotos (title) values('$title')") or 
die(mysql_error());

    if($_FILES['file']['name']!="")
    {
    //echo $_FILES['file']['name'];
    $tblData=mysql_query("Select MAX(photoid) as id from tblsliderphotos");
    $row=mysql_fetch_array($tblData);

    $id=$row['id'];

    $path="photos/SliderPhotos/". $id.".".$image_ext;
    echo $path;
    move_uploaded_file($_FILES["file"]["tmp_name"],"../../".$path);
    mysql_query("Update tblsliderphotos SET path='".$path."' where 
photoid=".$id);
    }
}
  • 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-14T03:36:14+00:00Added an answer on June 14, 2026 at 3:36 am

    I think the problem is not with php env. but with your upload file handling.

    let’s suppose your html code something like below

    <form action="someaction" method="post" enctype="multipart/form-data">
    <input type="text" name="title" />
    <input type="file" name="file" />
    <input type="file" name="file2" />
    <input type="submit" name="submitBtn" value="Submit">
    </form>
    

    Now, you have to notice there is two input of type “file”, first one have name value “file”, and the second have name value “file2”.

    When you want to deal with both, you have to handle every file alone. as below:

    $_FILES['file'] // this will give you information about the first input "file"
    
    $_FILES['file2'] // this will give you information about the second input "file2"
    

    Now, when you want to upload both of files, you have to do this for each. as below:

     // handling first file
    if($_FILES['file']){
       echo $_FILES['file']['name'];
       move_uploaded_file($_FILES["file"]["tmp_name"],"../../".$path);
    }
    
    // handling second file
    if($_FILES['file2']){
       echo $_FILES['file2']['name'];
       move_uploaded_file($_FILES["file2"]["tmp_name"],"../../".$path);
    }
    

    This will upload both of files to your $path

    However you can do same thing with looping over $_FILES variable, as below:

     foreach($_FILES as $key => $value){
         echo $key."\r\n";
         echo $value['name'];
         move_uploaded_file($value["tmp_name"],"../../".$path);
     }
    

    I hope this help

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

Sidebar

Related Questions

I have a little question .. I am using blob to upload my files
Hello I am using PHP to allow users to upload files and I have
I am unable to upload large files to Sharepoint 2010. I am using Visual
I have to upload a 3gp audio file to my server using MultipartEntity. i
Literally, I am unable to upload anything to my server via the normal HTML
I'm attempting upload multiple files in ASP.NET MVC and I have this simple foreach
I'm trying to upload images using Graph API Batch Request, but i'm unable to
Hi i'm trying to upload an image using a php script. And whats really
I am using this code to upload files, but when I upload a file
My application asks the user to select files for upload using a FileReference /

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.