簡單的php檔案上傳系統

來源:互聯網
上載者:User

標籤:php 檔案上傳

<?phpif (isset ($_GET[‘type‘])&& $_GET[‘type‘]=="send"){    if ($_FILES[‘userfile‘][‘error‘]==0) {          /*echo ‘File Name: ‘.$_FILES[‘userfile‘][‘name‘].‘<br>‘;          echo ‘File Type: ‘.$_FILES[‘userfile‘][‘type‘].‘<br>‘;          echo ‘File Size: ‘.$_FILES[‘userfile‘][‘size‘].‘<br>‘;          echo ‘Temporary Name: ‘.$_FILES[‘userfile‘][‘tmp_name‘].‘<br>‘;*/          $tmpFile= $_FILES[‘userfile‘][‘tmp_name‘];          $newFile=getcwd().‘/‘.$_FILES[‘userfile‘][‘name‘];          if (move_uploaded_file($tmpFile, $newFile))                   echo ‘                   <p style="text-align: center;font-size: 17pt;color: #008000;"><strong>Your file is uploaded successfully.</strong></p>                    ‘;          else                   echo ‘                   <p style="text-align: center;font-size: 17pt;color: #FF0000;"><strong>An error occurred while uploading.</strong></p>                    ‘;    }else          echo ‘An Error occuerd NO.: ‘.$_FILES[‘userfile‘][‘error‘].‘<br>‘;}?><html><body>    <div style="text-align: center; height: 58px;background-color: #DFDFFF;" ><form enctype= "multipart/form-data" action= "<?php echo $_SERVER[‘PHP_SELF‘].‘?type=send‘ ?>" method= "POST" style="background-color: #DFDFFF;">    <input type="hidden" name="MAX_FILE_SIZE" value="30000" />        <span style="color: #008000;">    <strong><span style="font-size: 20pt;">Upload Your File:</span><br></strong></span><br style="font-size: 20pt;"><span style="font-size: 15pt;"><strong>File: </strong>        </span> <input name="userfile" type="file" style="width: 253px" /> <br>        <br style="font-size: 10pt;">    <input type="submit" value="Send" style="width: 86px; height: 43px" />    <br><font face="Tahoma"><a target="_blank" href="http://www.pinlan.com/"><span style="font-size: 8pt; text-decoration: none">PHP Free Code</span></a></font>   </form></div></body></html>


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.