Jump to content

upload pic and mysql not updating or uploading


Jamied_uk

Recommended Posts

<?php error_reporting (E_ALL ^ E_NOTICE); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Members Upload Page</title>
<link href="/css/loginmodule.css" rel="stylesheet" type="text/css" />
</head>
<body>
<body style="background:#000000">
<link rel="shortcut icon" href="/favicon.ico">
<style type="text/css">
    A{font:18px/20px Verdana;color:#33CC66;margin-left:10px;}
    #Header{font:18px Verdana;font-weight:bold;text-align:center;color:#000000;}
    .TableHeader{font:18px Verdana;font-weight:bold;color:#000000;padding-left:15px;}
    .BodyCaption{font:18px/20px Verdana;font-weight:bold;color:#000000;}
    .BodyText{font:11px/20px Verdana;color:#000000;margin-left:20px;}
  </style>
<a style="#00FF80">
<h1>Welcome <?php echo $_SESSION['SESS_FIRST_NAME'];?></h1>
<a href="/">Back To Home Page</a> | <a href="/">Back</a> 
<p>
<center>

<p>Profile Picture Uploader </p>


<tr>
        <td colspan="3">
            <h1>J~Net</h1>



<form enctype="multipart/form-data" action="up2.php" method="POST">
Please choose a file: <input name="uploaded" type="file" /><br />
<input type="submit" value="Upload" /pics>
</form> 
<?php 
$target = "/pics"; 
$target = $target . basename( $_FILES['uploaded']['name']) ; 
$filename = $target . basename( $_FILES['uploaded']['name']) ; 
$path = $target = "/pics"; 
$mysql_path = $path."/".$filename;
$ok=1;
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) 
{
echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded";
} 


else {
echo "Please Browse For The File You Wish To Upload.";
}


?>
        </td>
<P>You Are Authorised To View The Following Pages...
</p>
<center>
<a href="/developer/jay/uploads/">View Uploaded Files</a></p>
<a href="/apps/time_clock/timeclock.php">Clock In</a></p>
Default password is "password" and should be changed!<p>




</p>
</p>
<a href="http://www.box.net/shared/a6ztyzdodn">J~Webs Start Page Update File (From Box.net)!</a></p>

<?php
include("connect.inc.php");

//sql query to be executed.
$sql = "INSERT INTO `users`(`filename`,`path`) VALUES ('$filename','$mysql_path')";
?>



</a><br><br><form action="http://google.com/search" name=f><table cellpadding=0 cellspacing=0><tr valign=top><td width=25%> </td><td align=center nowrap><input name=hl type=hidden value=en><input maxlength=2048 name=q size=55 title="Google Search" value=""><br><input name=btnG type=submit value="Google Search"><input name=btnI type=submit value="I'm Feeling Lucky"></td><td nowrap width=25%><font size=-2>  <a href=http://google.com/advanced_search?hl=en>Advanced Search</a><br>  <a href=http://google.com/preferences?hl=en>Preferences</a><br>  <a href=http://google.com/language_tools?hl=en>Language Tools</a></font></td></tr><tr><td align=center colspan=3><font size=-1><span style="text-align:left">Search: <input id=all type=radio name=meta value="" checked><label for=all> the web </label><input id=cty type=radio name=meta value="cr=countryUK|countryGB"><label for=cty> pages from the UK
<p><a href="/"><img src="input.gif"
</a>
<center>
<?php include "/css/footer.php"; ?>
</body>
</html>

 

any ideas why this doesn't upload pic to folder and update to my database the details?

the page displays but dosnt do the 2 tasks.

I see you still havn't read the rules then....

 

this:

<input type="submit" value="Upload" /pics>

should not contain the word pics.

 

this:

$target = "/pics"; 

could require a trailing /

 

this:

$target = $target . basename( $_FILES['uploaded']['name']) ;
$filename = $target . basename( $_FILES['uploaded']['name']) ;
$path = $target = "/pics"; 

is wrong, $target should not be changed and $path need not be created as it's just the same as $target will be after you don't change it.

 

this:

$mysql_path = $path."/".$filename;

is going to set $mysql_path to /pics/picsfilename.ext - just use $filename, delete $path

 

this

if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) 

needs to have $target replaced with $filename.

 

 

 

and that's just at a glance, make those changes and let us know how it goes.

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.