- Impact
- 34
Hi i have instaled and image hosting script.
What i want and i think that it might be "simple" is when someone use the code to put the img to vb or to the webpage / blog a link to my site.
here is the code
Thanks alot
What i want and i think that it might be "simple" is when someone use the code to put the img to vb or to the webpage / blog a link to my site.
here is the code
PHP:
<?php
if($_SERVER['REQUEST_METHOD'] == 'POST') {
preg_match('/\.([a-zA-Z]+?)$/', $_FILES['file']['name'], $matches);
if(in_array(strtolower($matches[1]), $accepted)) {
if($_FILES['file']['size'] <= $maxsize) {
$newname = md5_file($_FILES['file']['tmp_name']).'.'.$matches[1];
move_uploaded_file($_FILES['file']['tmp_name'], $filedir.'/'.$newname);
$linkurl = 'http://'.$_SERVER['HTTP_HOST'].preg_replace('/\/([^\/]+?)$/', '/', $_SERVER['PHP_SELF']).'#'.$newname;
$imgurl = 'http://'.$_SERVER['HTTP_HOST'].preg_replace('/\/([^\/]+?)$/', '/', $_SERVER['PHP_SELF']).$filedir.'/'.$newname;
print '<p>Click 2 view in full size:<br /> <a href="'.$imgurl.'" target="_blank"><img src="'.$imgurl.'" border="0" width="50px" height="35px" /></a><br />
<label for="codebb">Embed on bulletin boards:</label><br />
<input type="text" class="textfield" id="codebb" value="[IMG]'.$imgurl.'[/IMG]" onclick="javascript:this.focus();this.select();" size="70" readonly="true" /><br />
<label for="codehtml">Embed on webpages or MySpace: </label><br />
<input type="text" class="textfield" id="codehtml" value=\'<a href="'.$linkurl.'"><img src="'.$imgurl.'" alt="Image hosting by '.$title.'" /></a>\' onclick="javascript:this.focus();this.select();" size="70" readonly="true" /><br />
<label for="codedirect">Direct link:</label><br />
<input type="text" class="textfield" id="codedirect" value="'.$imgurl.'" onclick="javascript:this.focus();this.select();" size="70" readonly="true" /></p>';
} else
print '<p>Sorry, that file is too big.</p>';
} else
print '<p>Sorry, that file type is not supported.</p>';
}
?>
Thanks alot






