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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:26:32+00:00 2026-05-22T01:26:32+00:00

I initialize the variables, use move_uploaded_file function and then I write a basic form

  • 0

I initialize the variables, use move_uploaded_file function and then I write a basic form user will use to upload their photo. I am trying to print at lease an error_msg or a sucess_msg showing wether they had sucess in loading the file or not. nothings is showwing up. Help!

           $error_msg = "";
           $success_msg = "";
           $name2 = "";


       if ($_POST['parse_var'] == "pic"){

        if (!$_FILES['fileField']['tmp_name']) { 

            $error_msg = '<font color="#FF0000">ERROR: Please browse for an image before you press submit.</font>';

        } else {

            $maxfilesize = 51200; // 51200 bytes equals 50kb
            if($_FILES['fileField']['size'] > $maxfilesize ) { 

                        $error_msg = '<font color="#FF0000">ERROR: Your image was too large, please try again.</font>';
                        unlink($_FILES['fileField']['tmp_name']); 

            } else if (!preg_match("/\.(gif|jpg|png)$/i", $_FILES['fileField']['name'] ) ) {

                        $error_msg = '<font color="#FF0000">ERROR: Your image was not one of the accepted formats, please try again.</font>';
                        unlink($_FILES['fileField']['tmp_name']); 

            } else { 

                        $newname = $id'.jpg';
                        $place_file = move_uploaded_file( $_FILES['fileField']['tmp_name'], "images/$id/".$newname);
                        $success_msg = '<font color="#009900">Your image has been updated, it may take a few minutes for the changes to show... please                                                    be patient.</font>';
            }

        } // close else that checks file exists

}


    <table width="709" align="center" cellpadding="5">
            <form action="edit_profile.php" enctype="multipart/form-data" method="post" name="pic1_form" id="pic1_form">
          <!--    <tr>
                <td width="125" class="style7"><div align="center"><strong>Please Do First &rarr;</strong></div></td>

              </tr>-->
              <tr>
            <td width="16%"><?php print "$user_pic"; ?></td>
            <td width="74%">
              <input name="fileField" type="file" class="formFields" id="fileField" size="42" />
              50 kb max
           </td>
            <td width="10%">
              <input name="parse_var" type="hidden" value="pic" />
              <input  type="submit" name="button" id="button" value="Submit" />
            </td>
           </tr>
           </form></table>
  • 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-22T01:26:33+00:00Added an answer on May 22, 2026 at 1:26 am

    I don’t see anywhere in that code where you are echoing the error or success message.

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

Sidebar

Related Questions

I'm banging my head on the keyboard trying to figure out a way to
I've got an activity, where I initialize some static variable (Menu of the app).
I have an NSTimer that I initialize with scheduledTimerWithTimeInterval: with a very short interval
I am trying to create a separate model class for image uploading, which was
I have never used a Transaction, Commit and Rollback before and now I need
Lets say I have a fairly complex frag shader for figuring out just how
I am developing a library that initializes plain-old data objects from data retrieved from
I asked this question about multithreading in servlet, and many people suggest using a
I used readData successfully to read 16-bit audio files and generate peak files for
This is homework...I'm not asking for answers, I just have a bug I'm not

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.