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
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.
Link to comment
Share on other sites

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]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.