• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Website Help

RunarM

Finally back
Joined
Jul 17, 2008
Messages
1,636
Reaction score
32
Location
Norway/Tromsø
NEW:
i want the picture to come up when you upload a picture, with a link..
Can anyone help me with it?



Yours, RunarM.
 
Last edited:
Okay..

Upload.php
PHP:
<? 
    echo '<?xml version="1.0" encoding="iso-8859-2"?>'; 
    $allowed_files = array('jpg', 'jpeg', 'bmp', 'png', 'gif', 'dib', 'jpe', 'jfif', 'tif', 'tiff', '001', '2bp', '2d', '3d', '3d2', '3d4', '3da', '3df', '3dl', '3dm', '3dmf', '3ds', '3dv', '3dx', '8pbs', 'amb', 'ac5', 'ac6', 'acr', 'act', 'adc', 'adi', 'afp', 'agif', 'agp', 'ai', 'ais', 'amu', 'an8', 'anm', 'apng', 'ard', 'arr', 'art', 'asat', 'awd', 'bcf', 'bcp', 'bip', 'biz', 'blend', 'blkrt', 'blz', 'bmc', 'bmf', 'br3', 'br4', 'br5', 'bro', 'bvh', 'c4', 'c4d', 'cag', 'cal', 'cals', 'cam', 'can', 'catpart', 'cd2', 'cd5', 'cdr', 'cdt', 'ce', 'cel', 'cgm', 'cil', 'cin', 'cit', 'cld', 'cm2', 'cmp', 'cmx', 'cmz', 'cmv', 'comicdoc', 'cpc', 'cpt', 'cr2', 'crw', 'crz', 'csd', 'csf', 'csm', 'cut',  ); 
    $download_path = 'images/'; 
    $max_file_size = 5242880; 
?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html> 
    <head> 
        <meta http-equiv="Content-type" content="text/html; charset=iso-8859-2" /> 
        <title> 
            Upload.com 
        </title> 
        <style> 
            .error { color: red } 
            a { color: gray; text-decoration: none } 
            a:visited { color: gray; text-decoration: none } 
            a:hover { color: gray; text-decoration: underline } 
        </style> 
    </head> 
    <body> 
        <div align="center"> 
            <a href="index.php">File list</a> 
            <form enctype="multipart/form-data" action="upload.php" method="POST"> 
                <input type="hidden" name="MAX_FILE_SIZE" value=<?=$max_file_size?>/> 
                <input name="file" type="file" size="40"/><br /> 
                <input type="submit" value="Send Your File"/> 
            </form> 
        <? 
            $tmp_file = $_FILES['file']['tmp_name']; 
            $name = $_FILES['file']['name']; 
            $size = $_FILES['file']['size']; 
            $extension = explode(".", $name); 
            $ext = end($extension); 
             
            if(is_uploaded_file($tmp_file)): 
                if(!in_array($ext, $allowed_files)): 
                    echo '<span class="error">Not allowed extension.</span>'; 
                    return true; 
                endif; 
                 
                $newname = createName($ext); 
                move_uploaded_file($tmp_file, $download_path.''.$newname); 
                echo '<strong><a href="download.php?file='.$newname.'">'.$newname.'</a></strong> (<strong>'.size($size).'</strong>) has been succesfully uploaded.'; 
            endif; 
             
            function createName($extension) 
            { 
                $length = 6; 
                $pattern = 'ABCDEFGHKLMNOPQRSTWXYZabcdefghjkmnpqrstwxyz123456789'; 
                $max = strlen($pattern) - 1; 
                $random = ''; 
                mt_srand((double)microtime() * 1000000); 
                for($i = 0; $i < $length; $i++) 
                    $random .= $pattern[mt_rand(0, $max)]; 
                 
                return $random.'.'.$extension; 
            } 
             
            function size($size) 
            { 
                $size = $size; 
                $s = 'b'; 
                 
                if($size >= 1073741824): 
                    $size = $size / 1024 / 1024 / 1024; 
                    $s = 'gb'; 
                elseif($size >= 1048576): 
                    $size = $size / 1024 / 1024; 
                    $s = 'mb'; 
                elseif($size >= 1024): 
                    $size = $size / 1024; 
                    $s = 'kb'; 
                endif; 
                 
                return round($size, 2).' '.$s; 
            } 
        ?> 
        </div> 
    </body> 
</html>

Upload.html (dont think im using it)
HTML:
<?
    echo '<?xml version="1.0" encoding="iso-8859-2"?>';
    $allowed_files = array('jpg', 'jpeg');
    $download_path = 'Images/';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    <head>
        <meta http-equiv="Content-type" content="text/html; charset=iso-8859-2" />
        <title>
            Upload.com
        </title>
        <style>
            .error { color: red }
            a { color: gray; text-decoration: none }
            a:visited { color: gray; text-decoration: none }
            a:hover { color: gray; text-decoration: underline }
        </style>
    </head>
    <body>
        <div align="center">
            <a href="index.php">File list</a>
            <form enctype="multipart/form-data" action="upload.php" method="POST">
                <input type="hidden" name="MAX_FILE_SIZE" value=<?=$max_file_size?>/>
                <input name="file" type="file" size="40"/><br />
                <input type="submit" value="Send Your File"/>
            </form>
        <?
            $tmp_file = $_FILES['file']['tmp_name'];
            $name = $_FILES['file']['name'];
            $size = $_FILES['file']['size'];
            $extension = explode(".", $name);
            $ext = end($extension);
            
            if(is_uploaded_file($tmp_file)):
                if(!in_array($ext, $allowed_files)):
                    echo '<span class="error">Not allowed extension.</span>';
                    return true;
                endif;
                
                if($handle = opendir($download_path)):
                    while(false !== ($file = readdir($handle))):
                        if($name == $file):
                            echo '<span class="error">File with that name is already on our server.</span>';
                            return true;
                        endif;
                    endwhile;
                endif;
                move_uploaded_file($tmp_file, $download_path.''.$name);
                echo '<strong><a href="download.php?file='.$name.'">'.$name.'</a></strong> (<strong>'.size($size).'</strong>) has been succesfully uploaded.';
            endif;
        ?>
        </div>
    </body>
</html>
 
Okay oO..

i want the picture to come up when you upload it, with a link..
Can anyone help me with it?

PHP:
<?
    echo '<?xml version="1.0" encoding="iso-8859-2"?>';
    $allowed_extensions = array('jpg', 'jpeg');
    $download_path = 'images/';
	$max_file_size = 5242880;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    <head>
        <meta http-equiv="Content-type" content="text/html; charset=iso-8859-2" />
        <title>
            Upload.com
        </title>
        <style>
            .error { color: red }
            a { color: gray; text-decoration: none }
            a:visited { color: gray; text-decoration: none }
            a:hover { color: gray; text-decoration: underline }
        </style>
    </head>
    <body>
        <div align="center">
            <a href="index.php">File list</a>
            <form enctype="multipart/form-data" action="upload_.php" method="POST">
                <input type="hidden" name="MAX_FILE_SIZE" value=<?=$max_file_size?>/>
                <input name="file" type="file" size="40"/><br />
                <input type="submit" value="Send Your File"/>
            </form>
        <?
            $tmp_file = $_FILES['file']['tmp_name'];
            $name = $_FILES['file']['name'];
            $size = $_FILES['file']['size'];
            $extension = explode(".", $name);
            $ext = end($extension);
            
            if(is_uploaded_file($tmp_file)):
                if(!in_array($ext, $allowed_extensions)):
                    echo '<span class="error">Not allowed extension.</span>';
                    return true;
                endif;
                
				$newname = createName($ext);
                move_uploaded_file($tmp_file, $download_path.''.$newname);
                echo $newname.' (<strong>'.size($size).'</strong>) has been succesfully uploaded.<br /><a href="download.php?file='.$newname.'"><img src="'.$download_path.''.$newname.'" width="480" height="320"/></a>';
            endif;
			
			function createName($extension)
			{
				$length = 6;
				$pattern = 'ABCDEFGHKLMNOPQRSTWXYZabcdefghjkmnpqrstwxyz123456789';
				$max = strlen($pattern) - 1;
				$random = '';
				mt_srand((double)microtime() * 1000000);
				for($i = 0; $i < $length; $i++)
					$random .= $pattern[mt_rand(0, $max)];
				
				return $random.'.'.$extension;
			}
			
			function size($size)
			{
				$size = $size;
				$s = 'b';
				
				if($size >= 1073741824):
					$size = $size / 1024 / 1024 / 1024;
					$s = 'gb';
				elseif($size >= 1048576):
					$size = $size / 1024 / 1024;
					$s = 'mb';
				elseif($size >= 1024):
					$size = $size / 1024;
					$s = 'kb';
				endif;
				
				return round($size, 2).' '.$s;
			}
        ?>
        </div>
    </body>
</html>
 
PHP:
<?
    echo '<?xml version="1.0" encoding="iso-8859-2"?>';
    $allowed_extensions = array('jpg', 'jpeg');
    $download_path = 'images/';
	$max_file_size = 5242880;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    <head>
        <meta http-equiv="Content-type" content="text/html; charset=iso-8859-2" />
        <title>
            Upload.com
        </title>
        <style>
            .error { color: red }
            a { color: gray; text-decoration: none }
            a:visited { color: gray; text-decoration: none }
            a:hover { color: gray; text-decoration: underline }
        </style>
    </head>
    <body>
        <div align="center">
            <a href="index.php">File list</a>
            <form enctype="multipart/form-data" action="upload_.php" method="POST">
                <input type="hidden" name="MAX_FILE_SIZE" value=<?=$max_file_size?>/>
                <input name="file" type="file" size="40"/><br />
                <input type="submit" value="Send Your File"/>
            </form>
        <?
            $tmp_file = $_FILES['file']['tmp_name'];
            $name = $_FILES['file']['name'];
            $size = $_FILES['file']['size'];
            $extension = explode(".", $name);
            $ext = end($extension);
            
            if(is_uploaded_file($tmp_file)):
                if(!in_array($ext, $allowed_extensions)):
                    echo '<span class="error">Not allowed extension.</span>';
                    return true;
                endif;
                
				$newname = createName($ext);
                move_uploaded_file($tmp_file, $download_path.''.$newname);
                echo $newname.' (<strong>'.size($size).'</strong>) has been succesfully uploaded.<br /><a href="download.php?file='.$newname.'"><img src="'.$download_path.''.$newname.'" width="480" height="320"/></a>';
            endif;
			
			function createName($extension)
			{
				$length = 6;
				$pattern = 'ABCDEFGHKLMNOPQRSTWXYZabcdefghjkmnpqrstwxyz123456789';
				$max = strlen($pattern) - 1;
				$random = '';
				mt_srand((double)microtime() * 1000000);
				for($i = 0; $i < $length; $i++)
					$random .= $pattern[mt_rand(0, $max)];
				
				return $random.'.'.$extension;
			}
			
			function size($size)
			{
				$size = $size;
				$s = 'b';
				
				if($size >= 1073741824):
					$size = $size / 1024 / 1024 / 1024;
					$s = 'gb';
				elseif($size >= 1048576):
					$size = $size / 1024 / 1024;
					$s = 'mb';
				elseif($size >= 1024):
					$size = $size / 1024;
					$s = 'kb';
				endif;
				
				return round($size, 2).' '.$s;
			}
        ?>
        </div>
    </body>
</html>

Its only a picture, i need a link thing under like:
Direct Link: ********
Forum Link: ********

And when you click on the picture you comes to this:
http://localhost/download.php?file=** (Picture you just uploaded) **.bmp~
Which does not work, Can you fix the download thing too ;)
Thank you ^^



----Sorry for the double post -.- ----------
 
Last edited:
Here, edit to your needs:
PHP:
echo $newname.' (<strong>'.size($size).'</strong>) has been succesfully uploaded.<br /><a href="download.php?file='.$newname.'"><img src="'.$download_path.''.$newname.'" width="480" height="320"/></a>';
 
I have this:
PHP:
echo $newname.' (<strong>'.size($size).'</strong>) has been succesfully uploaded.<br /><a href="download.php?file='.$newname.'"><img src="'.$download_path.''.$newname.'" width="480" height="320"/></a>';

i need a link thing under the picture when you have uploaded:
Direct Link: ********
Forum Link: *******
Do you have that oO? ;)
 
I have this:
PHP:
echo $newname.' (<strong>'.size($size).'</strong>) has been succesfully uploaded.<br /><a href="download.php?file='.$newname.'"><img src="'.$download_path.''.$newname.'" width="480" height="320"/></a>';

i need a link thing under the picture when you have uploaded:
Direct Link: ********
Forum Link: *******
Do you have that oO? ;)

How do you want to manage your site when you cant even write one line of simple code? O_O

PHP:
    echo 'Direct Link: <a href="http://otland.net/images/'.$newname.'">http://www.YOURWEB.YOURDOMAIN/images/'.$newname.'</a><br />';
    echo 'Forum Link: [IMG]<a href="http://otland.net/images/'.$newname.'">http://www.YOURWEB.YOURDOMAIN/images/'.$newname.'</a>[/IMG]';
 
How do you want to manage your site when you cant even write one line of simple code? O_O

PHP:
    echo 'Direct Link: <a href="http://otland.net/images/'.$newname.'">http://www.YOURWEB.YOURDOMAIN/images/'.$newname.'</a><br />';
    echo 'Forum Link: [IMG]<a href="http://otland.net/images/'.$newname.'">http://www.YOURWEB.YOURDOMAIN/images/'.$newname.'</a>[/IMG]';

Where should i put em?


You said "How do you want to manage your site when you cant even write one line of simple code? O_O"
I answer: Easy, i'll just ask you ^^
 
Looooook!
Link.jpg


I want it under the picture.
 
Back
Top