PDA

View Full Version : [HELP] Upload Script



LOLROB
10-02-2008, 11:37 PM
i am doing the next vertion of slimupload.com
and im a bit stuck on the upload script (its a realy simple one)

it all works but when it uploads it comes up as this
http://img156.imageshack.us/img156/7060/helpbd9.jpg
I would like to add the URL to the file the dir is /upload/

this is the part of the code wich needs editing its come thing to do with echo because i dont know much about it would any one help please :)



<?php
//set where you want to store files
//in this example we keep file in folder upload
//$HTTP_POST_FILES['ufile']['name']; = upload file name
//for example upload file name cartoon.gif . $path will be upload/cartoon.gif
$path= "upload/".$HTTP_POST_FILES['ufile']['name'];
if($ufile !=none)
{
if(copy($HTTP_POST_FILES['ufile']['tmp_name'], $path))
{
echo "Successful<BR/>";
//$HTTP_POST_FILES['ufile']['name'] = file name
//$HTTP_POST_FILES['ufile']['size'] = file size
//$HTTP_POST_FILES['ufile']['type'] = type of file
echo "File Name :".$HTTP_POST_FILES['ufile']['name']."<BR/>";
echo "File Size :".$HTTP_POST_FILES['ufile']['size']."<BR/>";
echo "File Type :".$HTTP_POST_FILES['ufile']['type']."<BR/>";
echo "<img src=\"$path\" \">";
}
else
{
echo "Error";
}
}
?>


+Rep to all help

Thanks :)

RichardKnox
15-02-2008, 03:57 PM
Unerneath the line that starts with

echo "File Size:"

Add


echo "File URL: http://www.slimupload.com/uploads/".$HTTP_POST_FILES['ufile']['name']."<BR/>";

That should work :)

LOLROB
15-02-2008, 06:37 PM
:eusa_clap
Unerneath the line that starts with

echo "File Size:"

Add


echo "File URL: http://www.slimupload.com/uploads/".$HTTP_POST_FILES['ufile']['name']."<BR/>";

That should work :)

Thanks so much :D
+Rep :)

Zedtu
15-02-2008, 11:47 PM
Register globals? Ew.

RichardKnox
16-02-2008, 09:06 PM
I agree with you on that Caleb :P

Zedtu
16-02-2008, 09:20 PM
I agree with you on that Caleb :P
Glad that it is gone forever in PHP6.

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