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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:15:03+00:00 2026-05-28T00:15:03+00:00

My code is an upload form that redirects all the uploaded files to a

  • 0

My code is an upload form that redirects all the uploaded files to a PHP processing script. The problem is, after I click “Submit” button, it redirects only to the processing page and stops there, the php page supposedly will process then redirect to another page called selectAlbum.php when upload is successful.

Here is the code for the forms:

 <html>
 <head>
<title> Sample1  - File Upload on Directory </title>
<style type="text/css">
/* jQuery lightBox plugin - Gallery style */
#form {
    background-color: #aaa;
    padding: 10px;
    width: 520px;
    border-left-width:center;
}
</style>
 </head>
 <body>
 <div id="form" align="center">
<form action="process.php" method="post" enctype="multipart/form-data">
    <input type="hidden" name="MAX_FILE_SIZE" value="1000000" />
        Create an Album (limited to 10 images): <br />
        Album name (Please specify):
    <input type="text" name="album_name" size="30" /> 
    <br />
    <input type="file" name="uploadedfile[]"  /><br />
    <input type="file" name="uploadedfile[]"  /><br />
    <input type="file" name="uploadedfile[]"  /><br />
    <input type="file" name="uploadedfile[]"  /><br />
    <input type="file" name="uploadedfile[]"  /><br />
    <input type="file" name="uploadedfile[]"  /><br />
    <input type="file" name="uploadedfile[]"  /><br />
    <input type="file" name="uploadedfile[]"  /><br />
    <input type="file" name="uploadedfile[]"  /><br />
    <input type="file" name="uploadedfile[]"  /><br />
    <br /> 
    <input type="submit" value="Upload File"   />
</form>
</div>

</body>
</html>

The code for the PHP PROCESS. process.php:

<?php 

    $target_path = "galleryholder/" .$_POST['album_name']. "/";

    if(!file_exists($target_path))
    {
        if(!mkdir($target_path, TRUE))
        {
            die ("could not create the folder");
        }
    }
    else
    {
        for($count = 0; $count < count($_FILES['uploadedfile']); $count++)
            {
                $target_path = $target_path . basename( $_FILES['uploadedfile']['name'][$count]); 
                $image_size[$count]  = getimagesize($_FILES['uploadedfile']['tmp_name'][$count]);

                if($image_size[$count] !== FALSE || ($image_size[$count]) != 0)
                {
                        if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'][$count], $target_path)) 
                        {
                        header('Location: selectAlbum.php');

                        } 
                        else
                        {

                            header('Location: uploader3.php');
                        }
                }
                else 
                {

                    header('Location: uploader3.php');
                }
            }
    }
?>

When upload is successful it goes here:

<html>
<head>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery.lightbox-0.5.js"></script>
<link rel="stylesheet" type="text/css" href="css/jquery.lightbox-0.5.css" media="screen" />

 <script type="text/javascript">
    $(function() {
        $('#gallery a').lightBox();

        $('#gallery1 a').lightBox();
    });
    </script>
    <style type="text/css">
    /* jQuery lightBox plugin - Gallery style */
    #gallery {
        background-color: #aaa;
        padding: 10px;
        width: 520px;
        background-position:top;
    }
    #gallery ul { list-style: none; }
    #gallery ul li { display: inline; }
    #gallery ul img {
        border: 5px solid #3e3e3e;
        border-width: 5px 5px 20px;
    }
    #gallery ul a:hover img {
        border: 5px solid #fff;
        border-width: 5px 5px 20px;
        color: #fff;
    }
    #gallery ul a:hover { color: #fff; }
</style>
</head>
<body>

<?php
$page = $_SERVER['PHP_SELF'];

//settings
$column = 5;

//directories

$base = "galleryholder";
//$thumbs ="thumbs";

//get album
$get_album = $_GET['album'];
if(!$get_album)
{
    echo "<b> Select an Album:</b><p />";
    $handle = opendir($base);
    while(($file = readdir($handle))!== FALSE)
    {
        if(is_dir($base."/".$file) && $file != "." && $file != "..")
        {
            echo "<a href='$page?album=$file'>$file</a><br />"; //$file. "<br />";
        }
    }
}
else
{
    //echo "An album has been clicked.";
    if (!is_dir($base."/".$get_album) || strstr($get_album,".")!=NULL || strstr($get_album,"/")!=NULL || strstr($get_album,"\\")!=NULL)
    {
        echo "The album doesn't does not exist";
    }
    else
    {
        echo "<h2 id='example'><b>$get_album</b></h2><p />";
        echo "<div align='center' id='gallery'>";
        echo "<ul>";    
        $handle = opendir($base."/". $get_album);
        while(($file = readdir($handle))!== FALSE)
        {
            if($file != "." && $file != "..")
            {

                echo "<li>";
                echo "<a href='$base/$get_album/$file'><img src='$base/$get_album/$file' height='100' width='100'>";
                echo "</li>";

            }

        }
        echo "</ul>";
    echo "</div>";
    }
}
?>

</body>
</html>
  • 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-05-28T00:15:03+00:00Added an answer on May 28, 2026 at 12:15 am

    Your problem is File Permission. PHP needs 777 for file uploads.

    Use unmask() to assign file permisson and then upload.

    See below link for unmask http://www.w3schools.com/php/func_filesystem_umask.asp

    and check your mkdir() function the second parameter is mode but you given as TRUE, and create recursive directory.

    Refer this link for mkdir() function http://www.w3schools.com/php/func_filesystem_mkdir.asp

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

Sidebar

Related Questions

I need a php code and sql code that will let someone upload an
I am trying to emulate the multiple upload files in html form that looks
I have a File.aspx form where I display all the files. When I upload
I have a web form that allows users to upload files while opening a
I have working code that will upload photo from form. However when I do
I have a PHP form that is inserting information into a database. It all
I'm looking for a basic code samples of how to upload files to server
I am using this PHP code: if (isset($_GET['c'])) { $pages = array(home, upload, signup);
This happens repeatedly and is very annoying. I upload some PHP code to a
I'm implementing an upload form so that my users can upload a background image

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.