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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:19:31+00:00 2026-06-11T00:19:31+00:00

I am having problem with this coding, the upload works fine just that, if

  • 0

I am having problem with this coding, the upload works fine just that, if I didn’t upload any picture it will echo the error, if I upload just one picture it won’t show any error message, now I want to make it if nothing to be uploaded, it won’t echo the error message but I wanted to remain the error message just incase something went wrong I know there is problem. Thanks!

// Upload begins!!

if ($_FILES['ufile']['name'][0] != "")
    {
    $target_path =  "."."/uploads/".$petname."/".$_FILES['ufile']['name'][0];

    copy($_FILES['ufile']['tmp_name'][0], $target_path);
    $filesize1=$_FILES['ufile']['size'][0];
    }


    if ($_FILES['ufile']['name'][1] != "")
    {
    $target_path1 =  "."."/uploads/".$petname."/".$_FILES['ufile']['name'][1];

    copy($_FILES['ufile']['tmp_name'][1], $target_path1);
    $filesize2=$_FILES['ufile']['size'][1];
    }


    if ($_FILES['ufile']['name'][2] != "")
    {
    $target_path2 =  "."."/uploads/".$petname."/".$_FILES['ufile']['name'][2];

    copy($_FILES['ufile']['tmp_name'][2], $target_path2);
    $filesize3=$_FILES['ufile']['size'][2];
    }

// Check for error!!
    if($filesize1 || $filesize2 || $filesize3 != 0) 
    {
    }

// If got error, show message 
    else 
    {
    echo "<div class='error'>ERROR : There seems to be problem uploading the pictures.</div>";
    }
  • 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-11T00:19:32+00:00Added an answer on June 11, 2026 at 12:19 am

    I managed to solved it myself, bottom here is my solution:-

    if ($_FILES['ufile']['name'][0] != "")
    {
    $target_path =  "."."/uploads/".$petname."/".$_FILES['ufile']['name'][0];
    
    if (!copy($_FILES['ufile']['tmp_name'][0], $target_path))
    {
        $a = 1; 
    }
    
    }
    
    else
    {
        $a = 0;
    }
    
    
    if ($_FILES['ufile']['name'][1] != "")
    {
    $target_path1 =  "."."/uploads/".$petname."/".$_FILES['ufile']['name'][1];
    
    if (!copy($_FILES['ufile']['tmp_name'][1], $target_path1))
    {
        $b = 1;
    }
    
    }
    
    else
    {
        $b = 0;
    }
    
    
    if ($_FILES['ufile']['name'][2] != "")
    {
    $target_path2 =  "."."/uploads/".$petname."/".$_FILES['ufile']['name'][2];
    
    if (!copy($_FILES['ufile']['tmp_name'][2], $target_path2))
    {
        $c = 1;
    }
    
    }
    
    else
    {
        $c = 0;
    }
    
    if ($a || $b || $c == 1)
    {
        echo "Error! There is problem uploading the pictures.";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am coding this layout as a wordpress theme and having a slight problem
I've having this problem with some JavaScript code. I've simplified it in the error
I'm having this problem where I keep getting this error in my console: *
I am currently coding a HTML website into wordpress. The problem that i'm having
I am having a similar problem coding this email for Outlook 2010 (of course).
I am having problem with this error: 'undefined' is null or not an object'
having a problem with coding with miranda am just a newbie to functional programming
there's this problem I'm having, while coding a little table with an hover-effect, causing
I'm having hardstop with this problem to solve in my Excel macro coding. My
I am having problem with this javascript function. If I want to submit a

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.