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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:52:29+00:00 2026-06-17T16:52:29+00:00

I have made a dynamic dropdown file upload system where user can choose the

  • 0

I have made a dynamic dropdown file upload system where user can choose the engineering stream, then the semester and then subject, and the file gets uploaded in the desired directory. This works fine normally. Working example Check the file path link, upload only images or docs two three times in different folders to see how it varies.

Then I wanted to show the file upload progress so I downloaded and started using this uploadify. And came across the following problems.

Two problems here:
1) The moment I click select files and select a file, the file gets uploaded, but I can’t find it anywhere though I have set the targetFolder
2) I want to choose the path first, then select the file, and click upload (like shown in the exmaple) and then I want it to get uploaded in the specified directory which I chose from the dropdowns.

Link to demo: Uploadify Fail Example

This is my code:

    <!DOCTYPE html>
<html lang="en">
    <head>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8">
        <title> SRMUARD - Upload </title>
        <link rel="stylesheet" type="text/css" href="uploadify.css" />
        <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
        <script type="text/javascript" src="jquery.uploadify-3.1.min.js"></script>  
        <script type="text/javascript">
            $(function() {
                $('#file_upload').uploadify({
                    'swf'      : 'uploadify.swf',
                    'uploader' : 'uploadify.php',
                    'progressData' : 'speed',
                    'folder': <?php echo $targetFolder; ?>
                });
            });
        </script>
        <script type="text/javascript">
            function val()
            {
                if(document.uploads.three.selectedIndex == 0)
                {
                    alert("Please choose all the appropriate options");
                }
            }
        </script>   
        <script>
            $(function() {
                $("#text-one").change(function() {
                $("#text-two").load("textdata/" + $(this).val() + ".txt");
                });
                $("#text-two").change(function() {
                $("#text-three").load("textdata/" + $(this).val() + ".txt");
                });
            });
         </script>

    </head>
    <body>
        <div>
            <form action="uploadify.php" method="POST" enctype="multipart/form-data" name="upload" id="upload">
                <label for="file">Choose a file: </label><br/>

                    <select id="text-one" name="one">                   
                        <option selected value="base">Select Department</option>
                        <option value="CSE" name="cse">Computer Science Engineering</option>
                        <option value="ECE" name="ece">Electronics & Communication Engineering</option>
                        <option value="MECH" name="mech">Mechanical Engineering</option>                        
                    </select><br/><br/> 
                    <select id="text-two" name="two">
                        <option>Select Semester</option> //Displays options dynamically using text files
                    </select><br/><br/>                 
                    <select id="text-three" name="three">
                        <option>Select Subject</option> //Displays options dynamically using text files
                    </select><br/><br>  
                    <input type="file" name="file_upload" id="file_upload" ><br/><br/>  
                    <input type="submit" name="upload" id="submit" value="Upload" onClick="val()" />        
            </form>
        <div>
    </body>
</html>

And this is my uploadify.php file:

    <?php

    if(isset($_POST['upload']))  //checking if the path is set
   { 
      $path1=$_POST['one']."/"; //path1
      $path2=$_POST['two']."/"; //path2
      $path3=$_POST['three']."/";   //path3
      $targetFolder=$path1.$path2.$path3; //final path without the file
   }
   else
   {
      echo "Select a Subject";
      echo "<br>";
   }


if (!empty($_FILES)) {
    $tempFile = $_FILES['file_upload']['tmp_name'];
    $targetPath = $_SERVER['DOCUMENT_ROOT'] . $targetFolder;
    $targetFile = rtrim($targetPath,'/') . '/' . $_FILES['file_upload']['name'];
    // Validate the file type
    $fileTypes = array('jpg','jpeg','gif','png'); // File extensions
    $fileParts = pathinfo($_FILES['file_upload']['name']);
    if (in_array($fileParts['extension'],$fileTypes)) {
        move_uploaded_file($tempFile,$targetFile);
        echo $targetFolder . '/' . $_FILES['file_upload']['name'];
    } else {
        echo 'Invalid file type.';
    } 
?>

Please help me solve this and make me show the progress bar and make it upload to the correct destination folder.

Thank You

  • 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-17T16:52:30+00:00Added an answer on June 17, 2026 at 4:52 pm

    This plagin ‘uploadify’ uploads files earlier then you have chosen elements of the form. You can add data in the parametr ‘formData’ like this:

    $(function() {
    var one = $('#text-one').val();
    var two = $('#text-two').val();
    var one = $('#text-three').val();
    $('#file_upload').uploadify({
    'swf' : 'uploadify.swf',
    'uploader' : 'uploadify.php',
    'progressData' : 'speed',
    'formData': {'one':one,'two':'two','three':three},
    'folder': 
    });
    });
    

    Answer will come in the event ‘onUploadComplete’

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

Sidebar

Related Questions

I have made a dynamic dropdown file upload system where user can choose the
I have a dynamic form that adds users to the site, made so you
I am creating a dynamic form where a user selects an area then a
I have made a C++ library and have built a .dylib dynamic library from
I have made a wordpress plugin that can fetch an unknown number of Google
I have made following relative layout in an xml file lets say add_relative_layout.xml <?xml
I've made dynamic forms that can update an entire list of options with a
I have a dynamic form that can be cloned, using the SheepIt! plugin to
I have made a little CQRS API for our system I tried to replace
guys i have made a jquery and css based star rating system. now i

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.