simple php code for file hosting website is request (like rapidshare.com)?

A common question:

hi all ,
i want to create a file hosting website using php ,
1000s’ of file hosting website already online , i want to create another one =)

i want it to be secure and don’t want junk files to flood my server , can you please give me a simple upload.php code to handle the files (and give the users download link "not direct download link" ) thanks

the index.html looks like this

——————–
<html>
<body>

<form action="upload.php" method="post"
enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file" />
<br />
<input type="submit" name="submit" value="Submit" />
</form>

</body>
</html>
——————————–


Expert Answer: It is not your fault you got confused. Web hosting is the heart of your web presence and can mean the success and failure for your business.

Before we answer your question, let us review the 7 factors to look for in a good web hosting. An excellent hosting:

  1. does not suspend accounts as easily,
  2. gives unlimited webspace,
  3. offers unlimited bandwidth,
  4. gives multiple add-on domains,
  5. has easy-to-use Site Builder,
  6. has Fantastico and QuickInstall to quickly install apps like WordPress, Joomla, Drupal, OSCommerce, ZenCart and more
  7. can be easily upgraded to VPS or one of the best dedicated server plans if and when your business require.

Answering the above question, more than 80% of experienced Webmasters recommend to try Hostgator. If you need an “unlimited” hosting plan, experts usually highly recommend going with Hostgator because they are the best domain hosting around.

What if you find out that Hostgator sucks after you signed up with them? HG has an amazingly long, 45 days money back guarantee so you have ample time to test them out. They are rated A+ by Better Business Bureau which shows their commitment to customer satisfaction. You also do not have to pay for the first month. You can just try their fully functional hosting service – you pay only $0.01 (you need to use the special coupon ). Do you know any other hosting company that can give you that kind of assurance? Anybody can grab an account from Hostgator for almost FREE.

How to Get an Unlimited Hosting Plan for Only 1 Cent

Click the coupon below try Hostgator cPanel hosting for almost free. If you already know that Hostgator is what you want, you can even save 25% off the normal price.

Who Should Not Try Hostgator

To be honest, no web hosting service is perfect. Drawback of Hostgator includes:

  1. No free domain name – but you can easily get a domain name from the best domain registrar such as Godaddy or Namecheap for $10 or less. Would you agree that a website is not complete without a domain name?
  2. You need to pay full price after your first invoice – well, they need to make money too and all the support and great service do come with a cost

If you are still not sure if HG is right for you, or you have specific query about anything at all, try the Live Chat at HG. They are fast and knowledgeable. Just shoot them some questions before you decide.

  1. ElricTheFullMetal
    April 16th, 2012 at 05:52
    Reply | Quote | #1

    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!