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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:48:42+00:00 2026-06-14T12:48:42+00:00

I am not sure what is wrong with this code, so I was hoping

  • 0

I am not sure what is wrong with this code, so I was hoping for some helpful input.

The Problem

It will not get the name of the file that I have uploaded nor is it actually uploading it into the defined directory.

The PHP Code

<? include("header.php"); 
include("sidebar.php");
?>        



    <h2>Add Raffle</h2> 

 <?
$name = asql($_POST['name']);
$type = asql($_POST['prize']);
$min_points = asql($_POST['minp']);
$min_cash = asql($_POST['maxu']);
$cons = strtotime($_POST['cons']);
$cone = strtotime($_POST['cone']);


if($_POST['subm'])
{
if ($name == NULL OR $type == NULL OR $min_points == NULL OR $min_cash == NULL) {
print"Please Fill Out All Of The Required Fields<br /><a href='rafadd.php'><img src='img/green_arrow_left.png' alt='Go Back' /></a>"; include"footer.php";
exit();
}
if (!in_array($file['type'], array("image/gif", "image/jpeg", "image/png"))
           || $file['size'] > 20000)
  {
  if ($_FILES["file"]["error"] > 0)
    {
    echo "There was an error";
    }
  else
    {
    echo "";
$filename = $_FILES["file"]["name"];
    if (file_exists("../images/rewards/" . $_FILES["file"]["name"]))
      {
unlink("../images/raffles/" . $_FILES["file"]["name"]);
      move_uploaded_file($_FILES["file"]["tmp_name"],
      "../images/raffles/" . $_FILES["file"]["name"]);
      }
    else
      {
      move_uploaded_file($_FILES["file"]["tmp_name"],
      "../images/raffles/" . $_FILES["file"]["name"]);
      }
    }
  }
else
  {
  echo "Invalid file";


$updatecontests = mysql_query("INSERT INTO raffles (`id`, `raffle_name`, `raffle_prize`, `buy_in`, `max_entry`, `prize_image`, `start`, `end`) VALUES ('','$name','$type','$min_points','$min_cash','images/raffles/".$filename."','$cons','$cone')") or die(mysql_error());

if($updatecontests){
$create = mysql_query("CREATE TABLE IF NOT EXISTS `".$name."` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `username` text NOT NULL,
  `entries` int(11) NOT NULL,
  PRIMARY KEY (`username`(30)),
  KEY `id` (`id`)
)");
}
print "You Have Successfully Added this Raffle<br /><br />
<a href='rafadd.php'><img src='img/green_arrow_left.png' alt='Go Back' /></a>"; 




    }
    else
    {

print"<div class='form'>
         <form action='' method='post'><input type=hidden name=subm value=1>";
?>
         <div class="element">
                        <label for="name">Raffle Name: <span class="red">(required)</span></label>
                        <input id="name" name="name" size="50" />
                    </div>
         <div class="element">
                        <label for="prize">Raffle Prize: <span class="red">(required)</span></label>
                        <input id="prize" name="prize" size="50" />
                    </div>
<div class='element'>
                        <label for='file'>Prize Image:</label>
                        <input type='file' name='file' id='file' />
                    </div>

                    <div class="element">
                        <label for="cons">Start Date: <span class="red">(required)</span></label>
                        <input id="cons" name="cons" size="50" /><a href="javascript:NewCal('cons','mmddyyyy',true,12)"><img src="images/cal.gif" width="16" height="16" border="0" alt="Pick a date"></a>
                        </div>
                    <div class="element">
                        <label for="cone">End Date: <span class="red">(required)</span></label>
                        <input id="cone" name="cone" size="50" /><a href="javascript:NewCal('cone','mmddyyyy',true,12)"><img src="images/cal.gif" width="16" height="16" border="0" alt="Pick a date"></a>
                        </div>
                    <div class="element">
                        <label for="minp">Cost Per Ticket: <span class="red">(required)</span></label>
                        <input id="minp" name="minp" size="50" />
                        </div>
                    <div class="element">
                        <label for="maxu">Maximum Entries per User: <span class="red">(required 0 for unlimited)</span></label>
                        <input id="maxu" name="maxu" size="50" />
                        </div>
<?php
                    print" <dl class='submit'>
                    <input type='submit' name='subm' id='subm' value='Submit' />
                     </dl>


         </form>
         </div> "; 
      }
      ?>

     </div><!-- end of right content-->


  </div>   <!--end of center content -->               




    <div class="clear"></div>
    </div> <!--end of main content-->


    <div class="footer">

        <div class="left_footer">IN ADMIN PANEL | Powered by <a href="http://indeziner.com">INDEZINER</a></div>
        <div class="right_footer"><a href="http://indeziner.com"><img src="images/indeziner_logo.gif" alt="" title="" border="0" /></a></div>

    </div>

</div>      
</body>
</html>

I have used the file upload snippet in another script and it uploads perfectly so I am not sure why it is not working here.

  • 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-14T12:48:44+00:00Added an answer on June 14, 2026 at 12:48 pm
    <form action='' method='post'>
    

    is wrong, needs to be:

     <form action='' method='post' enctype='multipart/form-data'>
    

    Also, use <?php instead of <?

    PS I miss the point where $file is set.

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

Sidebar

Related Questions

I'm not totally sure but this looks wrong: I have a header file named
This code is giving me a SyntaxError. Not sure what is wrong. import numpy
Not sure what is wrong with this code. I keep getting the following error:
I'm not sure whts wrong with this code... else if (combo_View.Text == Orders) {
I am not sure what's wrong with this code : std::vector<int> myVector(0); if (myVector.back()
not sure what is wrong with this jquery code: http://jsfiddle.net/aCABM/ I want to to
Not sure what I am doing wrong here. I am hoping that it is
I got this error message and I'm not quite sure whats wrong: Exception in
Now I'm not sure if this is something I'm doing wrong, or something thats
I know this probably really simple but Im not sure what im doing wrong...

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.