Thanks, worked perfect
One last thing

How can i have it so when an image is uploaded it will also display the link to it aswell.. i tried this ..
Code:
<?php
if(isset($_FILES['file']) == false OR $_FILES['file']['error'] == UPLOAD_ERR_NO_FILE)
{
die('Error');
}
if($_FILES['file']['error'] != UPLOAD_ERR_OK)
{
die('Error Uploading');
}
$path = '/home/vekaria/public_html/imagehosting/';
$path2 = 'http://www.lyricalsoundz.com/imagehosting/';
$file = $path . $_FILES['file']['name'];
move_uploaded_file($_FILES['file']['tmp_name'], $file);
// get ext
$ext = substr(strrchr($_FILES['file']['name'], '.'), 1);
// make img array
$imgexts = array('jpg','jpeg','gif','png','jfif','bmp');
if ( in_array($ext, $imgexts) )
{
die('<img src="' . $path2 . $_FILES['file']['name'] . '" />');
}
{
print $path2 . $_FILES['files']['name'];
}
?>
but it only displays the link for anything that is NOT an image, i want it to also apear when an image is uploaded aswell.
Okay ive managed to get it to display the link but having trouble linking the image to do the url.
it just doesnt display when i view the source its there...
Code:
<?php
if(isset($_FILES['file']) == false OR $_FILES['file']['error'] == UPLOAD_ERR_NO_FILE)
{
die('Error');
}
if($_FILES['file']['error'] != UPLOAD_ERR_OK)
{
die('Error Uploading');
}
$path = '/home/vekaria/public_html/imagehosting/';
$path2 = 'http://www.lyricalsoundz.com/imagehosting/';
$file = $path . $_FILES['file']['name'];
move_uploaded_file($_FILES['file']['tmp_name'], $file);
// get ext
$ext = substr(strrchr($_FILES['file']['name'], '.'), 1);
// make img array
$imgexts = array('jpg','jpeg','gif','png','jfif','bmp');
if ( in_array($ext, $imgexts) )
{
echo ('<img src="' . $path2 . $_FILES['file']['name'] . '" /> <br />');
}
if ( in_array($ext, $imgexts) )
{
echo ('<a href="' . $path2 . $_FILES['file']['name'] . '" >');
}
?>
Okay my mistake, i fixed it and its working

wow im getting good at this.
here it is..
Code:
<?php
if(isset($_FILES['file']) == false OR $_FILES['file']['error'] == UPLOAD_ERR_NO_FILE)
{
die('Error');
}
if($_FILES['file']['error'] != UPLOAD_ERR_OK)
{
die('Error Uploading');
}
$path = '/home/vekaria/public_html/imagehosting/';
$path2 = 'http://www.lyricalsoundz.com/imagehosting/';
$file = $path . $_FILES['file']['name'];
move_uploaded_file($_FILES['file']['tmp_name'], $file);
// get ext
$ext = substr(strrchr($_FILES['file']['name'], '.'), 1);
// make img array
$imgexts = array('jpg','jpeg','gif','png','jfif','bmp');
if ( in_array($ext, $imgexts) )
{
echo ('<img src="' . $path2 . $_FILES['file']['name'] . '" /> <br />');
}
if ( in_array($ext, $imgexts) )
{
echo ('<a href="' . $path2 . $_FILES['file']['name'] . '" >Image URL</a>');
}
?>
Any suggestions to make it shorter ?