安裝使用PHPnow後程式無法使用有關問題

來源:互聯網
上載者:User
安裝使用PHPnow後程式無法使用問題
////////////////////////////////////////////////////////////////////// 
(2)upload.php ---
//簡要說明
上傳介面,使用者選擇檔案,然後提交給submit.php處理
值得注意的是一個 MAX_FILE_SIZE的隱藏範圍,通過設定其VALUE可
以限制上傳檔案的大小。
//程式源碼


檔案上傳表單







method='post'>
選擇上傳檔案
type='submit'>




(3)submit.php ---
//簡要說明
把使用者上傳得檔案連同檔案的基本資料儲存到資料庫裡
//程式源碼
if($myfile != "none" && $myfile != "") { //有了上傳檔案了

//設定逾時限制時間,預設時間為 30秒,設定為0時為不限時
$time_limit=60;
set_time_limit($time_limit); //

//把檔案內容讀到字串中
$fp=fopen($myfile, "rb");
if(!$fp) die("file open error");
$file_data = addslashes(fread($fp, filesize($myfile)));
fclose($fp);
unlink($myfile);

//檔案格式,名字,大小
$file_type=$myfile_type;
$file_name=$myfile_name;
$file_size=$myfile_size;

//串連資料庫,把檔案存到資料庫中
$conn=mysql_connect("127.0.0.1","***","***");
if(!$conn) die("error : mysql connect failed");
mysql_select_db("test",$conn);

$sql="insert into receive
(file_data,file_type,file_name,file_size)
values ('$file_data','$file_type','$file_name',$file_size)";
$result=mysql_query($sql);

//下面這句取出了剛才的insert語句的id
$id=mysql_insert_id();

mysql_close($conn);
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.