Page 2 of 2 FirstFirst 12
Results 11 to 12 of 12
  1. #11

    Default

    Here is the one i used for www.host-mania.com/upload

    Feel free to use what you need.

    PHP Code:
    <?php
    $uploadLocation 
    "";
    ?>



    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">

    <html>

    <head>

       <title>Host-Mania :: Uploader</title>

       <link href="style/style.css" rel="stylesheet" type="text/css" />

    </head>

    <body>
    <div>
      <div align="center"><span class="style1"><img src="logo.gif" alt="" width="500" height="141" /></span></div>
    </div>
        <div id="main">

    <div id="caption">UPLOAD FILE</div>

          <div id="icon">&nbsp;</div>

          <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="fileForm" id="fileForm" enctype="multipart/form-data">

            File to upload:<center>

            <table>

              <tr><td><input name="upfile" type="file" size="36"></td></tr>

              <tr><td align="center"><br/><input class="text" type="submit" name="submitBtn" value="Upload"></td></tr>

            </table></center>  

          </form>

    <?php    

        
    if (isset($_POST['submitBtn'])){



    ?>

          <div id="caption">RESULT</div>

          <div id="icon2">&nbsp;</div>

          <div id="result">

            <table width="100%">

    <?php



    $target_path 
    $uploadLocation basename$_FILES['upfile']['name']);


    if(
    move_uploaded_file($_FILES['upfile']['tmp_name'], $target_path)) {

        echo 
    "The file: ".  basename$_FILES['upfile']['name']).

        
    " has been uploaded! And it is located here: <a href='http://www.host-mania.com/upload/" $_FILES['upfile']['name'] . "' target='_blank'>" "http://www.host-mania.com/upload/" $_FILES['upfile']['name'] . "</a>";

    echo 
    "<br><br>Here is a code to show the image: <br>" "<textarea name='textarea' cols='40' rows='4' wrap='VIRTUAL'><a href='http://www.host-mania.com/upload/" $_FILES['upfile']['name'] . "' target='_blank'><img src='" "http://www.host-mania.com/upload/" $_FILES['upfile']['name'] . "'/></a></textarea>";

    } else{

        echo 
    "There was an error uploading the file, please try again!";

    }



    ?>

            </table>

         </div>

    <?php            

        
    }

    ?>

        <div>
    <div>
      <div align="center">Copyright 2008 Host-Mania.com</div>
    </div>
    <br />
      <div align="center">
        <!-- Begin BidVertiser code -->
        <SCRIPT LANGUAGE="JavaScript1.1" SRC="http://bdv.bidvertiser.com/BidVertiser.dbm?pid=102223&bid=386020" type="text/javascript"></SCRIPT>
        <noscript>
          <a href="http://www.bidvertiser.com">make money</a>
        </noscript>
        <!-- End BidVertiser code --> 
      </div><br />
    </body>
    You should just be able to replace the text that says host-mania. As is uses $_SERVER['PHP_SELF'] for the form!
    Last edited by HostMania; 07-08-2008 at 04:27 PM.


  2. #12
    Join Date
    Aug 2008
    Location
    Australia!
    Posts
    33
    Tokens
    0

    Default

    Fix to line 56:

    $file_name = $person.time().$_FILES['userfile']['name'];

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •