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

The Archive Base Latest Questions

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

I have created a script that will upload files to a general uploads folder,

  • 0

I have created a script that will upload files to a general uploads folder, the upload works fine however when I try to get the script to move the files from the temp folder to the uploads folder. I get the following issue.

[23-Mar-2012 18:57:21 UTC] PHP Warning:  move_uploaded_file(): Unable to move '/var/tmp/php3O42Kn' to '/home3/***/***/***/MAINFOLDER/uploads/itworks/' in /home3/***/***/***/MAINFOLDER/admin/uploader.php on line 21

When I had the uploads folder in the same directory as the uploader.php script it was working, however I placed my uploader.php script in the /admin folder while keeping the /uploads in the root folder. Below is the script I am using.

uploader.php (main/admin)

  <?php

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


        $targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
        $targetFile =  str_replace('//','/',$targetPath) . $filename;


        // $fileTypes  = str_replace('*.','',$_REQUEST['fileext']);
        // $fileTypes  = str_replace(';','|',$fileTypes);
        // $typesArray = split('\|',$fileTypes);
        // $fileParts  = pathinfo($_FILES['Filedata']['name']);

        // if (in_array($fileParts['extension'],$typesArray)) {
                if (!file_exists($targetPath)) {  
                     mkdir(str_replace('//','/',$targetPath), 0755, true);  
                }

            move_uploaded_file($tempFile,$targetFile);
            echo str_replace($_SERVER['DOCUMENT_ROOT'],'',$targetFile);
        // } else {
        //  echo 'Invalid file type.';
        // }
    }
    ?>

upload.php (main/admin)

<script type="text/javascript"> 
    $(document).ready(function() {
        $("#file_upload").uploadify({
            'uploader'     : 'includes/uploadify.swf',
            'script'         : 'uploadify.php',
            'folder'         : '../uploads',
            'cancelImg'      : 'includes/images/cancel.png',
            'multi'          : true,
            'auto'           : false,
            'fileTypeExts'        : '*.jpg;*.gif;*.png',
            'fileTypeDesc'       : 'Image Files (.JPG, .GIF, .PNG)',
            'queueID'        : 'custom-queue',
            'queueSizeLimit' : 10,
            'simUploadLimit' : 3,
            'sizeLimit'   : 10240000,
            'removeCompleted': true,
            'onAllComplete'  : function(stats) {
                $('#status-message').text(data.filesUploaded + ' files uploaded, ' + data.errors + ' errors.');
            }
        });
    });
</script>

I think the issue is here: 'folder' : '../uploads',. Idealy I want the uploader.php file to automatically push the directory back one level however all my methods seem not to have worked.

Many thanks to anyone who could help me shed some light on this!

  • 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-31T20:15:05+00:00Added an answer on May 31, 2026 at 8:15 pm

    It could be one of the following depending on how far root is from the current admin directory.

    '../../uploads'
    

    or

    '../../../uploads
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a PHP script that receives uploads and it works fine in mamp,
I have created a script that saves some files in the Documents directory of
I have created a Greasemonkey script that runs fine in the firebug editor, with
I have a script that performs some simple editing which works fine, the problem
Hey I have created a Groovy script that will extract the version numbers of
I have created a PHP-script to update a web server that is live inside
I have created a dynamic list picker script using Jquery 1.3 and PHP that
I have written a CGI script that creates an image dynamically using GET data.
I have a php script that transfers a bunch of files between servers with
I'm trying to create an FTP script that will copy a local folder structure

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.