Here's my code, first:
The problem is when I upload, it doesn't upload the file. It doesn't even give me the thumbs up code. Help?
PHP Code:
<?php
/**
* Home.php
* @author starr-gaming.com
* @copyright 2010
*/
if (!defined("VALID_PHP"))
die('Direct access to this location is not allowed.');
if(isset($_GET['sort']))
$sort = str_replace("-", " ", $_GET['sort']);
else
$sort = 'site_votes DESC';
if(isset($_GET['loggedin']))
$msg_info = 'You have logged in.';
$rows = $sites->getSites(array("field"=>"site_active", "value"=>"Yes"), $sort);
$i = (intval($_GET['p']) * intval($_GET['ipp'])) - intval($_GET['ipp']);
if($i < 0) $i = 1;
if(isset($_POST['submit']))
{
$return = $sites->submitSite();
if($return)
redirect("/index.php?page=home&siteadded=1");
}
if(isset($_GET['siteadded']))
{
if($settings->set['site_admin_site_activation'] == 'On')
$msg_ok = 'Your site has been added. You site will be shown once an administrator approves it.';
else
$msg_ok = 'Your site has been added. It is now visible on the site.';
}
?>
<?php display_message(); ?>
<h1><?php echo $page_title; ?></h1>
<div class="right">
<form action="/index.php?page=home" enctype="multipart/form-data" method="post">
<table class="box">
<tbody>
<tr>
<fieldset>
<h2>Browse for your file:<em> required</em></h2>
<div class="file_input_div">
<input type="button" value="Browse »" class="file_input_button" />
<input type="file" name="site_url" class="file_input_hidden" onchange="javascript: document.getElementById('fileName').value = this.value" /></div>
<input type="text" id="fileName" class="file_input_textbox" readonly="readonly" />
<img src="/images/info.png" class="tooltip" title="The URL to your site, eg: www.yoursite.com." />
<?php
$target_path = "uploads/";
$target_path = $target_path . basename( $_FILES['site_url']['name']);
if(move_uploaded_file($_FILES['site_url']['tmp_name'], $target_path))
{
echo "The file ". basename( $_FILES['site_url']['name']).
" has been uploaded";
}
?>
</fieldset>
</tr>
<tr>
<fieldset>
<h2>What are you uploading?<em> optional</em></h2>
<input id="name" name="site_description" size="30" type="text" class="input_textbox" value="" />
<img src="/images/info.png" class="tooltip" title="Tell us a little about what your uploading." />
</fieldset>
</tr>
</tbody>
<tfoot>
<tr>
<fieldset class="buttons">
<input type="hidden" name="form_key" id="form_key" value="<?php echo $_SESSION['form_key']; ?>" />
<button id="upload_button" name="submit" type="submit" value="Upload Now »">Upload Now »</button>
</fieldset>
</tr>
</tfoot>
</table>
</form>
</div>
Comment