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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T07:37:11+00:00 2026-06-07T07:37:11+00:00

I have an uploadify script running, basic setup. Works fine when I hard code

  • 0

I have an uploadify script running, basic setup. Works fine when I hard code the destination folder for the images into uploadify.php – now I want to make that folder dynamic. How do I do this?

I have a PHP variable $uploadify_path which contains the path to the folder I want. I have switched out my hard coded $targetPath = path/to/directory for $targetPath = $uploadify_path in both uploadify.php and check_exists.php, but it does not work. The file upload animation runs, says it is complete, yet the directory remains empty. The file is not hiding out somewhere else either.

I see there is an option in the Javascript to specify a folder. I tried this also, but to no avail.

If anyone could educate me on how to pass this variable destination to uploadify, I’d be very grateful.

I include my current code for checking (basically default):

The Javascript

<script type="text/javascript">
$(function() {

    $('#file_upload').uploadify({
        'swf'      : 'uploadify/uploadify.swf',
        'uploader' : 'uploadify/uploadify.php',
        // Put your options here
    });
});
</script>

uploadify.php

$targetPath = $_SERVER['DOCUMENT_ROOT'] . $uploadify_path; // Relative to the root

if (!empty($_FILES)) {
    $tempFile = $_FILES['Filedata']['tmp_name'];
    $targetFile = $targetPath . $_FILES['Filedata']['name'];

    // Validate the file type
    $fileTypes = array('jpg','jpeg','gif','png'); // File extensions
    $fileParts = pathinfo($_FILES['Filedata']['name']);

    if (in_array($fileParts['extension'],$fileTypes)) {
        move_uploaded_file($tempFile,$targetFile);
        echo '1';
    } else {
        echo 'Invalid file type.';
    }
}
  • 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-07T07:37:14+00:00Added an answer on June 7, 2026 at 7:37 am

    JS

    <script type="text/javascript">
        $(function() {
    
            $('#file_upload').uploadify({
                'formData' : {'path':'/file/path'},
                'swf'      : 'uploadify/uploadify.swf',
                'uploader' : 'uploadify/uploadify.php'
                // Put your options here
            });
        });
    </script>
    

    PHP

    $targetPath = $_SERVER['DOCUMENT_ROOT'] . $_POST['path']; // Relative to the root
    
    if (!empty($_FILES)) {
        $tempFile = $_FILES['Filedata']['tmp_name'];
        $targetFile = $targetPath . $_FILES['Filedata']['name'];
    
        // Validate the file type
        $fileTypes = array('jpg','jpeg','gif','png'); // File extensions
        $fileParts = pathinfo($_FILES['Filedata']['name']);
    
        if (in_array($fileParts['extension'],$fileTypes)) {
            move_uploaded_file($tempFile,$targetFile);
            echo '1';
        } else {
            echo 'Invalid file type.';
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following script that works fine with uploadify, What i would like
I have setup uploadify which works fine on Firefox with mulitple image uploads. However,
I have problems returning JSON data after using Uploadify. This code works in Firefox,
Regarding Uploadify Hello, Currently I have a PHP only upload script and I'm planning
I have a php-script, which uploads mp3-files on my server. I use 'uploadify' for
We have an PHP XML parsing script that uploads photos to a folder structure
I have an image uploading script in which i use the following setup to
I have been using Uploadify in my PHP application for the last couple months,
I have wildcard subdomains for example: .example.com goes to example.com/app/ It seems uploadify works
I'm using uploadify (a jQuery uploading) script, which has basically a PHP file at

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.