if(move_uploaded_file($_FILES["item_file"]['tmp_name']["$j"],$path)) { //upload the file
      $GLOBALS['msg'] .= "File# ".($j+1)." ($filen) uploaded successfully<br>"; //Success message
      header('Location: ?'.rand()); //加呢行
}

TOP

本帖最後由 CSA41200 於 2013-11-4 21:48 編輯
if(move_uploaded_file($_FILES["item_file"]['tmp_name']["$j"],$path)) { //upload the file
      $GLOB ...
tonyli1212 發表於 2013-11-3 17:56


ching,跟你做法係得
但係無左upload成功果個message
有無方法show返果句成功upload ge message?

anyway,thanks !!!

TOP

try this
  1. function upload(){       
  2.         if(count($_FILES["item_file"]['name'])>0) { //check if any file uploaded
  3.                 $GLOBALS['msg'] = ""; //initiate the global message
  4.                 for($j=0; $j < count($_FILES["item_file"]['name']); $j++) { //loop the uploaded file array
  5.                         $filen = $_FILES["item_file"]['name']["$j"]; //file name
  6.                         $path = 'webupload/'.$filen; //generate the destination path
  7.                         if(move_uploaded_file($_FILES["item_file"]['tmp_name']["$j"],$path)) { //upload the file
  8.                                 $GLOBALS['msg'] .= "File# ".($j+1)." ($filen) uploaded successfully<br>"; //Success message
  9.                         }
  10.                 }
  11.         }
  12.         else {
  13.                 $GLOBALS['msg'] = "No files found to upload"; //Failed message       
  14.         }
  15.         //uploadForm(); //display the main form
  16.       header('Location: ?msg='.urlencode($GLOBALS['msg']));
  17. }
複製代碼
and in the uploadForm(), change
  1.         <?php if ($GLOBALS['msg']) { echo '<center><span class="err">'.$GLOBALS['msg'].'</span></center>'; }?>
複製代碼
to
  1.         <?php if ($_GET['msg']) { echo '<center><span class="err">'.$_GET['msg'].'</span></center>'; }?>
複製代碼

TOP

try thisand in the uploadForm(), changeto
tonyli1212 發表於 2013-11-4 23:11


ching,跟你ge做法的確係work,但係就無左upload成功ge message
即係圖中紅色果句

以下就係我成個php upload package下載link,希望各位高手幫我睇一睇
http://www.sendspace.com/file/zh69yc
附件: 您需要登錄才可以下載或查看附件。沒有帳號?註冊

TOP

如果你 submit 過張 form,refresh browser 撳確定會叫個 browser 將你頭先尐野重新 submit 一次,所以有 successful message,係無錯架喎...

TOP

如果你 submit 過張 form,refresh browser 撳確定會叫個 browser 將你頭先尐野重新 submit 一次,所以有 s ...
justlazy 發表於 2013-11-5 23:03


ching,有無方法做到兩全其美??
因小弟的php知識是有限公司...

TOP

回復 16# CSA41200

呢個係browser behaviour,唔關PHP事。如果你真係好唔想人地submit完refresh會重新submit,可以做個server side redirect去返同一頁.

TOP

回復  CSA41200

呢個係browser behaviour,唔關PHP事。如果你真係好唔想人地submit完refresh會重新submit ...
justlazy 發表於 2013-11-6 01:39


server side係點搞?

TOP

help~~~~

TOP

server side係點搞?
CSA41200 發表於 2013-11-6 06:34


試下submit完用header redirect啦
一係加個session黎check住佢

TOP