PDA

View Full Version : Need Help Real Quick.



lSFresh
23-10-2010, 01:26 AM
Hello, I have this PHP File upload script I modified and stuff, I just need help adding something in it. Basically you can view a LIVE version at maniaupload.net.

The guy sold it to me, and he hasn't been on to help me. I just need this one favor.

What I want is, once a user uploads an image, it can also be deleted by that user with the code given. For example: go to maniaupload.net and upload a test image. I have made the html, bbcode & direct link. I want an option for a box where it shows Delete link....

here's my FULL php upload script.



<?php
define ("MAX_SIZE","100000");
function getExtension($str) {
$i = strrpos($str,".");
if (!$i) { return ""; }
$l = strlen($str) - $i;
$ext = substr($str,$i+1,$l);
return $ext;
}
$errors=0;
if(isset($_POST['Submit']))
{
$image=stripslashes($_FILES['image']['name']);
if ($image)
{
$filename = stripslashes($_FILES['image']['name']);
$extension = getExtension($filename);
$extension = strtolower($extension);
if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "mov") && ($extension !="PNG") && ($extension !="bmp") && ($extension != "png") && ($extension != "gif"))
{

echo '<font color="red"><b>Extension not allowed</b></font><br>';
$errors=1;
}
else
{
$size=filesize($_FILES['image']['tmp_name']);


if ($size > MAX_SIZE*100000)
{
echo 'You have exceeded the size limit!';
$errors=1;
}

$image_name=time().'.'.$extension;

$newname="images/".$image_name;

$fullname="http://www.maniaupload.net/".$newname;



$copied = copy($_FILES['image']['tmp_name'], $newname);
if (!$copied)
{
echo '<font color=\"red\"><b>Upload Unsuccessful! Try Again?</b></font>';
$errors=1;
}}}}

if(isset($_POST['Submit']) && !$errors)
{
echo "File Uploaded Successfully! <br /><br /> <img src=\"$newname\" /> <br /><br />

<b>Direct Image Link:</b><br/><table width=\"338\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" id=\"Table1\">
<tr>
<td align=\"center\" valign=\"middle\"><textarea readonly name=\"message\" rows=\"1\" cols=\"50\">$fullname</textarea></td>
</tr>
</table></center><br>

<b>HTML Code:</b><br/><table width=\"338\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" id=\"Table1\">
<tr>
<td align=\"center\" valign=\"middle\"><textarea readonly name=\"message\" rows=\"1\" cols=\"50\">
<a href=\"$fullname\" target=\"_blank\"><img border=\"0\" src=\"$fullname\"></a>
</textarea></td>
</tr>
</table><br>

<b>BBCode <font color=\"red\">*NEW*</font></b><br>
<table width=\"338\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" id=\"Table1\">
<tr>
<td align=\"center\" valign=\"middle\">
<textarea readonly name=\"message\" rows=\"1\" cols=\"50\">
$fullname
</textarea></td>
</tr>
</table><br>
";
}

?>
I have more code but its not needed, its outside of the php tags. But can anyone help please. It's just adding a delete link so users can delete it if they choose.

Thanks.

Jonster
23-10-2010, 09:57 AM
The guy sold it to me...

...here's my FULL php upload script.

:S Would recommend removing it and asking for people to PM you who are generally interested in helping.

Dentafrice
23-10-2010, 09:11 PM
Well you really have two options... you can use a database or flat file system... decide which one you want and I'll be more then glad to help you.

Want to hide these adverts? Register an account for free!