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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:16:36+00:00 2026-06-11T13:16:36+00:00

now first thing is I’ve seen everywhere over the net what to do in

  • 0

now first thing is I’ve seen everywhere over the net what to do in the case that what I’m trying to do doesn’t work, I’ve tried all of the solutions and they don’t work, I’m obviously missing something.

I’m uploading multiple files from a form field. This works perfectly and runs some code that resizes etc deletes tmp files blah blah.

The problem is if I don’t want to upload any files the upload and image processing script still runs throwing a bunch of errors.

I’ve tried the following… plus a bunch more with some weird variations 😛

if($_FILES['gallery']['name']!=""){      // if files then...
include_once("gallery_edit_script.php");
  }

and

if (count($_FILES["gallery"]["name"] > 0)){   // if files count is more than 0 then...
include_once("gallery_edit_script.php");
  }

Would the fact that the gallery_edit_script.php is an include have something to do with it?

I checked the file error with…

$_FILES["gallery"]["error"]

It showed no files were selected to upload which was exactly what I wanted.

Any ideas people?

Thanks for anyone who has a look at this.

Cheers

Added HTML but like I said upload is working fine, it’s when I want to post the form and not include files to upload that I want it to skip the gallery script. This is on an edit page, so the user has submitted form, data added to db and files uploaded, then comes back and wants to edit data but not upload files.

HTML (simplified as there are heaps of fields etc)

<form action="inventory_edit_lease.php" enctype="multipart/form-data" name="myForm" id="myForm" method="post">
Gallery Photos <input class="input-file" type="file" name="gallery[]" id="gallery" multiple="multiple" />
<input class="button-edititem" type="submit" name="submit" id="button" value="" onclick="javascript:return validateMyForm();"/>
</form>

Sorry I didn’t add HTML first time round, form works so didn’t think I really needed it 😉

  • 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-11T13:16:37+00:00Added an answer on June 11, 2026 at 1:16 pm

    For those interested this is what worked 🙂

    I got this from another thread if($_FILES['files']['name']!="") run if files, don't run if no files headache

    if(!empty($_FILES['gallery']['tmp_name']))
     {
     include_once("gallery_edit_script.php");
     }
       else
       {
       header("Location: inventory_list_sales.php");
       }
    

    Funny thing is I tried this with another site I’m working on with almost identical code as I copied all the files and only edited small parts and it doesn’t work lol

    Thanks for everyone’s help 🙂

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

Sidebar

Related Questions

i'm trying to understand css and first thing i tried was this: <div style=
I tried a lot of things, first in the css now with jquery but
Right now the problem is that the first time when I click the image,
Right now I have a foreach loop that grabs the first link with an
Hey I'm trying to get into git, as an emacs user first thing to
First of all I just want to say that I never understood so well
First thing you should know is that this worked on Wednesday of last week
I am browsing trough the CI documentation particularly http://codeigniter.com/user_guide/libraries/pagination.html . First thing that was
I've inherited (no pun intended) an old ASP.NET 1.1 project that is now .NET
I'm trying use a UIScrollview inclined 350 degrees, the first thing I thought was

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.