php 圖片下傳 圖片不顯示

來源:互聯網
上載者:User
php 圖片上傳 圖片不顯示
這是上傳代碼
if($_POST[sub]){
$myfile=$_FILES[myfile];//先得到上傳的資料;
$name=$myfile[name];//得到檔案名稱
$size=$myfile[size];//得到檔案大小
$tmp=$myfile[tmp_name];//得到檔案臨時路徑
$arr=explode(".",$name);
$str=strtolower($arr[count($arr)-1]);//得到尾碼名
$newName=date("YmdHis").".".$str;
$picurl="uploadfile/".$newName;//資料庫中要儲存路徑
move_uploaded_file($_FILES["file"]["tmp_name"],"../uploadfile/".$_FILES["file"]["name"]);
mysql_query("insert into history (title,time,picurl,content,introduct) values ('$_POST[title]','$_POST[time]','$picurl','$_POST[content]','$_POST[introduct]')");
?>
這是顯示代碼
" width="100" height="100" />
本地可以用 上傳到伺服器後圖片不顯示,希望各位幫幫忙


------解決方案--------------------
$myfile=$_FILES[myfile];//先得到上傳的資料;
move_uploaded_file($_FILES["file"]["tmp_name"],"../uploadfile/".$_FILES["file"]["name"]);

到底叫啥名字
------解決方案--------------------
沒看到 $row[picurl] 在哪賦值的
------解決方案--------------------
引用:
沒看到 $row[picurl] 在哪賦值的

++
------解決方案--------------------
不需要刪除,1樓上面那句,只要把下面那句的file都改為myfile
如果刪了上面那句,那你代碼中的3.4.5行都要修改了
------解決方案--------------------
確定下這兩點:
1.你確定圖片上傳成功了嗎?在檔案夾能找到上傳的圖片?
2.圖片的相關資訊被儲存到資料庫了嗎?
3.如果以上兩點都無問題,請確定上傳到伺服器後,在本地可用的圖片地址路徑是否符合伺服器的url規則?
  • 聯繫我們

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