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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:37:15+00:00 2026-06-11T19:37:15+00:00

So, i’ve read this question about move_uploaded_file() problems. However, on my apache-powered localhost lamp

  • 0

So, i’ve read this question about move_uploaded_file() problems. However, on my apache-powered localhost lamp stack, its working just fine. So i think it may be a filesystem / path thing, and not a code thing.

when uploading files to my site locally, it works.

but when I’m on the QA server (which is nginx powered), i get this error:

2012/09/08 15:34:21 [error] 11794#0: *5187 FastCGI sent in stderr: "files not empty
PHP Warning:  move_uploaded_file(/var/www/qa.mysite.com/mysite/app/files/maps-aprilfools.tiff): failed to open stream: No such file or directory in /var/www/qa.mysite.com/mysite/app/models/files.php on line 516
PHP Warning:  move_uploaded_file(): Unable to move '/tmp/phpvdtznP' to '/var/www/qa.mysite.com/mysite/app/files/maps-aprilfools.tiff' in /var/www/qa.mysite.com/mysite/app/models/files.php on line 516" while reading response header from upstream, client: 72.xxx.xxx.xxx, server: qa.mysite.com, request: "POST /projects/3/files HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "qa.mysite.com", referrer: "http://qa.mysite.com/projects/3/files"

and this is the code that I wrote to handle uploading a file:

public function fileUploadToProject( $project_id ) {
    if ($_FILES["upload-file"]["error"] > 0) {
        echo "Error: " . $_FILES["file"]["error"] . "<br />";
    } else {

        $dbSuccess      = false;

        $tmp_name       = $_FILES["upload-file"]["tmp_name"];
        $name           = $_FILES["upload-file"]["name"]; // someFile.ext
        $size           = $_FILES['upload-file']['size']; //size in bytes
        $mime           = $_FILES['upload-file']['type']; //size in bytes

        $destination    = __FILES__.'/'.$name;
        $uploaded       = move_uploaded_file( $tmp_name, $destination );

        // add entry to database.

        /*
         * null because there is no container yet.
         * We're only uploading to local
         */
        $user_container_name = null; 

        $uploaded_by = LoggedInUser::get_user_id();

        /*
         * Set this 1 when we're not dealing with our external fileserver
         */
        $isLocal = 1;

        /*
         * Probably shouldn't do this forever for storage size reasons, but for now its useful.
         */
        $localPath = $destination;

        $task_id = null;

        if( $uploaded ) {
        $dbSuccess = $this->insertFileRefService( $task_id, 
                                                  $project_id,
                                                  $user_container_name, 
                                                  $name,
                                                  $mime, 
                                                  $size,
                                                  $uploaded_by,
                                                  $isLocal,
                                                  $localPath
                );
            if($dbSuccess) {
                return true;
            } else {
                // should I rollback / delete that file?
                return false;
            }
        } else {
            return false;
        }

    }
}

So, is there anything I should know about moving temp files to my filesystem with on nginx? or do you think it is simply a path problem? code problem?

Also, please note that line 516 is this: $uploaded = move_uploaded_file( $tmp_name, $destination );

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

    The folder had problems with permissions, among other things.

    the /files directory in that path actually doesn’t exist. I somehow never realized that the folder simply wasn’t there. Whoops.

    then, i had to determine what user was used by nginx to execute php:

    ps aux | grep "nginx"
    

    then i had to chown the files directory:

    chown -R root:userFromStep1 files
    

    then i had to chmod the directory:

    chmod g+w files
    

    that worked like a charm.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
This could be a duplicate question, but I have no idea what search terms
I don't have much knowledge about the IPv6 protocol, so sorry if the question
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I am reading a book about Javascript and jQuery and using one of the
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

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.