[英]Unable to upload the file from local machine to server using php function
我正在使用以下代碼在伺服器中上傳文件
move_uploaded_file($_FILES["uploadfile".$k]["tmp_name"],
"photoalbum/".$_SESSION["almgid"]."/".$_FILES["uploadfile".$k]["name"]);
$uploadfile = "photoalbum/".$_SESSION["almgid"]."/".$_FILES["uploadfile".$k]["name"];
此代碼在本地工作正常,但圖像未在服務器中上傳如何解決此問題,請幫助我,
這是我在服務器中上傳文件期間收到的錯誤消息
Warning: move_uploaded_file(photoalbum/1cutebaby05.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in /home/whspider/public_html/alumnimgmts/editprofile.php
我已經在表單中添加了enctype =“ multipart / form-data”,我已經檢查了圖像大小,
假設您正在運行Linux機器:
sudo chmod +w /path/to/photoalbum
如果他們在本地服務器上工作,那么這是與授權有關的問題。
嘗試
chmod("photoalbum/".$_SESSION["almgid"]."/",0755); // OR 0777 during testing only
在move_uploaded_file
之前
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.