I own a website called uplodu (hence the name...)
Basically it's a file sharing website dedicated to making sharing simple.
I've got the upload form in place and it all works, the only problem is - with the code I have the upload opens in a new page and doesn't have any tags such as code for forums, direct url, code for websites etc etc.
I was just wondering if there is any code i could use to add these tags?
As far as my (limited) knowledge goes, to show on the same page requires AJAX, but if that too can be provided it will help.
If any of that explanation was unclear you can go to www.uplodu.com and try the form for yourself.
here's a copy of the php upload file:
<?php
// Configuration - Your Options
$allowed_filetypes = array('.JPG','.jpg','.gif','.bmp','.PNG','.png','.GIF','.tif','.tiff','.ai','.psd','.jpeg','.psp','.bmp','.dxf','.eps','.ps','.svg','.pdf','.aac','.aif','.iff','.m3u','.mid','.midi','.mp3','.mpa','.ra','.ram','.wav','.wma','.3gp','.asf','.asx','.avi','.mov','.mp4','.mpg','.qt','.rm','.swf','.wmv','.asp','.css','.js','.jsp','.xhtml','.exe','.zip','.rar','.7z','.gz','.doc','.txt');
$max_filesize = 104857600; // Maximum filesize in BYTES (currently 0.5MB).
$upload_path = './upload/'; // The place the files will be uploaded to (currently a 'files' directory).
$filename = $_FILES['userfile']['name']; // Get the name of the file (including file extension).
$ext = substr($filename, strpos($filename,'.'), strlen($filename)-1); // Get the extension from the filename.
// Check if the filetype is allowed, if not DIE and inform the user.
if(!in_array($ext,$allowed_filetypes))
die('<font size="3" face="Tahoma" font color="black"><center>Sorry, you cant upload that file type at the moment.</font></a></center>');
// Now check the filesize, if it is too large then DIE and inform the user.
if(filesize($_FILES['userfile']['tmp_name']) > $max_filesize)
die('<font size="3" face="Tahoma" font color="black"><center>Sorry, that file is bigger than 100 MB, try a different file.</font></a></center>');
// Check if we can upload to the specified path, if not DIE and inform the user.
if(!is_writable($upload_path))
die('You cannot upload to the specified directory, please CHMOD it to 777.');
// Upload the file to your specified path.
$newname = substr(strtolower($filename),0,4).time().$ext;
if(move_uploaded_file($_FILES['userfile']['tmp_name'],$upload_path . $newname))
echo '<font size="3" face="Tahoma" font color="black"><center>Congratulations, your upload is ready. View it <a href="' . $upload_path . $newname . '" title="Your File" target="_blank">here</font></a></center>'; // It worked.
else
echo '<font size="3" face="Tahoma" font color="black"><center>Looks like an error occured, please try again!</font></a></center>'; // It failed :(.
?>

New Topic/Question
Reply




MultiQuote






|