有沒有人試過這個freewebhostingarea。 我已經檢查了所有內容,並且在我的服務器中運行它時工作正常。 但是當我運行到freewebhostingarea。它無法將上傳的文件移動到目錄。服務器:move_uploaded_file在freewebhostingarea中不起作用
我認爲這是關於目錄的權限。所以我把它設置爲777.任何想法?
這裏是我的代碼
$m_id=$_COOKIE['m_id'];
$image_type=$_POST['image_type'];
$upic="u_".$image_type."_pic";
$valid_formats = array("jpg", "png", "bmp","jpeg");
if(isset($_POST) and $_SERVER['REQUEST_METHOD'] == "POST")
{
$fileinfo=pathinfo($_FILES['photoimg']['name']);
$size = $_FILES['photoimg']['size'];
if(isset($fileinfo['extension']))
{
$ext=strtolower($fileinfo['extension']);
if(in_array($ext,$valid_formats))
{
if($size<(5*1024*1024)) // Image size max 1 MB
{
$name ="uploadimg.".$ext;
$tmp = $_FILES['photoimg']['tmp_name'];
if(move_uploaded_file($tmp,"../user/$m_id/$name"))
{
BLAH BLAH
exit("<script>window.location='../user_page_update.php?u_id=$m_id';</script>");
}
else
exit("<script>alert('failed');window.location='../user_page_update.php?u_id=$m_id';</script>");
}
else
exit("<script>alert('Image file size max 2 MB');window.location='../user_page_update.php?u_id=$m_id';</script>");
}
else
exit("<script>alert('Invalid file format..');window.location='../user_page_update.php?u_id=$m_id';</script>");
}
else
exit("<script>alert('Please select image..!');window.location='../user_page_update.php?u_id=$m_id';</script>");
exit;
}
你有什麼錯誤嗎?該功能是否可用於該託管?什麼是php.ini中的max_file_limit? – 2013-02-28 08:17:57
1.不,但我用is_dir檢查我的目錄路徑,它返回false。 2.我認爲是。 3.如何檢查?(我只在我的服務器中檢查php.ini:S) – Expl0de 2013-02-28 08:33:08
創建一個名爲info.php的文件,並將其放在這裏:'<?php phpinfo(); ?>然後在這裏發佈一個鏈接到該文件的URL – 2013-02-28 08:37:09