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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:00:11+00:00 2026-05-26T13:00:11+00:00

<?php $uploaddir = ‘media/’; $file = basename($_FILES[‘photo’][‘name’]); $uploadfile = $uploaddir . $file; if (move_uploaded_file($_FILES[‘photo’][‘tmp_name’],

  • 0
<?php
        $uploaddir = 'media/';
        $file = basename($_FILES['photo']['name']);

        $uploadfile = $uploaddir . $file;

        if (move_uploaded_file($_FILES['photo']['tmp_name'], $uploadfile)) {
        echo "GOOD";
        } else {
        echo "ERROR";
        }
?>

I have this php script on my AWS EC2 linux server.
And it always return ERROR. I did chmod 777 and chmod 755 but still complains.

What is the problem? This code works just fine with another web server not Amazon EC2.
Is there any limitation that I can not upload files(images) through php on Amazon EC2?

Thanks in advance..

  • 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-26T13:00:12+00:00Added an answer on May 26, 2026 at 1:00 pm

    You can check it by function file_exists..

    you can modify your code for better understanding..

    if($_FILES['photo']['error'] == ''){
        $uploaddir = 'media/';
        $file = basename($_FILES['photo']['name']);
    
        $uploadfile = $uploaddir . $file;
        if(file_exists($_FILES['photo']['tmp_name'])){
           if (move_uploaded_file($_FILES['photo']['tmp_name'], $uploadfile)) {
              echo "GOOD";
           }
        } 
        else {
           echo "ERROR";
        }
    
    }
    else{
        echo "Error In Uploading File";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

PHP stores its session information on the file system of the host of the
PHP, for all its warts, is pretty good on this count. There's no difference
My HTML FORM code: <form action=upload.php method=GET enctyped=multipart/form-data> <label for=file> Filename:</label> <input type=file name=loadedFile
Can someone explain to me why this happens? I have a file called profile.php
I have used file uploader(used PHP) in my application. In FireFox, and Internet Explorer8
How would I go about creating an HTML/PHP/AJAX file uploader with a progress bar?
I have a file uploader on my website, since i cannot use php I'm
I took this basic upload file script from php.net and it is giving two
I need a simple PHP file uploader to upload files on my web-site. It
I'm using AJAX to get data from server. The following is the php file.

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.