Jump to content

Argh This is Killing Me..


virtuexru

Recommended Posts

I know it's probably something really simple.. but the page only shows up to the point where it echos this line:

[b]You have not uploaded a resume yet, please do so now.[/b]

It doesn't show the upload form or anything below it??

[code] <?php

include 'config.php';
include 'opendb.php';

$ncheck= $_SESSION['results'][fullname];

$query  = "SELECT id, name FROM resumes WHERE name = '$ncheck'";
$result = mysql_query($query) or die('Error, query failed');
if(mysql_num_rows($result) == 0)
{

echo "<b>You have not uploaded a resume yet, please do so now.</b><br>";

if(isset($_POST['upload']) && $_FILES['userfile']['size'] > 0)
{
$fileName = $_SESSION['results'][fullname];
$tmpName  = $_FILES['userfile']['tmp_name'];
$fileSize = $_FILES['userfile']['size'];
$fileType = $_FILES['userfile']['type'];

$fp      = fopen($tmpName, 'r');
$content = fread($fp, filesize($tmpName));
$content = addslashes($content);
fclose($fp);


if(!get_magic_quotes_gpc())
{
$fileName = addslashes($fileName);
}

$query = "INSERT INTO resumes (name, size, type, content ) ".
"VALUES ('$fileName', '$fileSize', '$fileType', '$content')";

mysql_query($query) or die('Error, upload failed');

echo "File <b>".$fileName.".doc</b> uploaded Thank you.<br>";
?>
<p/><b><font color="red">Important: Only Word Documents and Rich Text are allowed.</font></b>
<br/><b>Your file name will be automatically converted to your first and last
name. <br/>For example: <font color="red">John Doe.doc</font>.</b>
<form method="post" enctype="multipart/form-data">
<table width="350" border="0" cellpadding="1" cellspacing="1">
<tr>
<td>
<input type="hidden" name="MAX_FILE_SIZE" value="500000">
<input name="userfile" type="file" id="userfile">
</td>
</tr>
</table>
<br/>
<input name="upload" type="submit" class="box" id="upload" value=" Upload ">
</form>
<?
}
include 'closedb.php';
}
else
{
while(list($id, $name) = mysql_fetch_array($result))
{
?>
<p/>You have already uploaded a resume. To view it, please click here: <a href="download.php?id=<?=$id;?>"><?=$name;?></a><br/>
<i>To delete this resume and upload a newer version, please click <a href="#">here</a>.</i>
<?       
}
}
?>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/29724-argh-this-is-killing-me/
Share on other sites

I didn't look really hard, but nothing jumped out at me.

Usually when I have a problem like this I just insert:
[code]echo 'hi2u';[/code]
at the last point that echo'ed.  Then I just cut -> paste and move that line down the page until it stops displaying.  Then you know where it blew up.
Try:

[code]
<?php

include 'config.php';
include 'opendb.php';

$ncheck= $_SESSION['results'][fullname];

$query  = "SELECT id, name FROM resumes WHERE name = '$ncheck'";
$result = mysql_query($query) or die('Error, query failed');
if(mysql_num_rows($result) == 0)
{

echo "<b>You have not uploaded a resume yet, please do so now.</b><br>";
}else
if(isset($_POST['upload']) && $_FILES['userfile']['size'] > 0)
{
$fileName = $_SESSION['results'][fullname];
$tmpName  = $_FILES['userfile']['tmp_name'];
$fileSize = $_FILES['userfile']['size'];
$fileType = $_FILES['userfile']['type'];

$fp      = fopen($tmpName, 'r');
$content = fread($fp, filesize($tmpName));
$content = addslashes($content);
fclose($fp);


if(!get_magic_quotes_gpc())
{
$fileName = addslashes($fileName);
}

$query = "INSERT INTO resumes (name, size, type, content ) ".
"VALUES ('$fileName', '$fileSize', '$fileType', '$content')";

mysql_query($query) or die('Error, upload failed');

echo "File <b>".$fileName.".doc</b> uploaded Thank you.<br>";
?>
[/code]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.