E
ElricTheFullMetal
Guest
I wont do the coding for you, here is an example to restrict file type to image type only. property_image is name of file input tag, in ur case replace it with file.
<?php
if (($_FILES['property_image']['type'] == 'image/gif')
|| ($_FILES['property_image']['type'] == 'image/jpeg')
|| ($_FILES['property_image']['type'] == 'image/png')
|| ($_FILES['property_image']['type'] == 'image/pjpeg')
&& ($_FILES['property_image']['size'] / 1024 < 2000))
{
$img_path=time(). $_FILES['property_image']['name'];
$sql="insert into propertyimage(property_id,image_path) values('$maxproductid','$img_path')";
mysql_query($sql)or die("SELECT Error: ".mysql_error());
if(mysql_affected_rows()>0)
{
move_uploaded_file($_FILES["property_image"]["tmp_name"],"upload/" .time(). $_FILES["property_image"]["name"]);
}
}
?>
For Link to this file, just pick up the path for particular file u uploaded from path table and give its absolute link my concatenatin appropriate strings.
If u dont understand whats going on here, then u better read php tutorial here :
http://www.w3schools.com/PHP/php_file_upload.asp
Good Luck!
<?php
if (($_FILES['property_image']['type'] == 'image/gif')
|| ($_FILES['property_image']['type'] == 'image/jpeg')
|| ($_FILES['property_image']['type'] == 'image/png')
|| ($_FILES['property_image']['type'] == 'image/pjpeg')
&& ($_FILES['property_image']['size'] / 1024 < 2000))
{
$img_path=time(). $_FILES['property_image']['name'];
$sql="insert into propertyimage(property_id,image_path) values('$maxproductid','$img_path')";
mysql_query($sql)or die("SELECT Error: ".mysql_error());
if(mysql_affected_rows()>0)
{
move_uploaded_file($_FILES["property_image"]["tmp_name"],"upload/" .time(). $_FILES["property_image"]["name"]);
}
}
?>
For Link to this file, just pick up the path for particular file u uploaded from path table and give its absolute link my concatenatin appropriate strings.
If u dont understand whats going on here, then u better read php tutorial here :
http://www.w3schools.com/PHP/php_file_upload.asp
Good Luck!