好吧,這讓我感到困惑。我的腳本在Mozilla中運行,但不是IE。我得到了IE此錯誤:僅在Internet Explorer中出現PHP錯誤
Warning: move_uploaded_file(uploads/properties/yh96gapdna8amyhhmgcniskcvk9p0u37/) [function.move-uploaded-file]: failed to open stream: Is a directory in /homepages/19/d375499187/htdocs/sitename/include/session.php on line 602
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpJkiaF3' to 'uploads/properties/yh96gapdna8amyhhmgcniskcvk9p0u37/' in /homepages/19/d375499187/htdocs/sitename/include/session.php on line 602
我在session.php文件的代碼是:
function addPhoto($subphotoSize,$subphotoType,$subphotoTmpname,$subphotoDesc,$subfieldID,$subsessionid){
global $database, $form;
/* Get random string for directory name */
$randNum = $this->generateRandStr(10);
$maxFileSize = 2500000; // bytes (2 MB)
$filerootpath = PHOTOS_DIR.$subsessionid."/";
if($subphotoType == "image/png"){
$filename = $randNum.".png";
} else if ($subphotoType == "image/jpeg"){
$filename = $randNum.".jpg";
}
$fullURL = $filerootpath.$filename;
/* Image error checking */
$field = "photo";
if(!$subphotoTmpname){
$form->setError($field, "* No file selected");
} else {
if($subphotoSize > $maxFileSize) {
$form->setError($field, "* Your photo is above the maximum of ".$maxFileSize."Kb");
} else if (!is_dir($filerootpath)){
mkdir($filerootpath,0777);
chmod($filerootpath,0777);
}
move_uploaded_file($subphotoTmpname, "$fullURL");
}
/* Errors exist, have user correct them */
if($form->num_errors > 0){
return 1; //Errors with form
} else {
if($subfieldID == "1"){ // If the first field...
$is_main_photo = 1;
} else {
$is_main_photo = 0;
}
if(!$database->addNewPhoto($ownerID,$subphotoDesc,$fullURL,$userSession,$is_main_photo, $subsessionid)){
return 2; // Failed to add to database
}
}
return 0; // Success
}
它創建的文件夾沒有問題,但沒有做任何事情。
你可以打印'$ fullURL'並顯示輸出結果嗎? – PeeHaa
你在傳遞這個函數是什麼?看看它們在兩個瀏覽器中是否有所不同。例如,如果您傳遞的是來自'$ _FILES'的文件名,請嘗試類似'var_dump($ _ FILES);'的方式查看IE和Firefox是否有區別。 –
var_dump displays:array(1){[「photo」] => array(5){[「name」] => string(8)「6122.jpg」[「type」] => string(11)「image/pjpeg「[」tmp_name「] => string(14)」/ tmp/phpu8oMmx「[」error「] => int(0)[」size「] => int(493526) – user29660