понеже нищо неразбирамот пхп а си сложих един ъплоад скрипт и ми дава следната грешка
значи скрипта си работи на хостинг сървара но от вкащи от apache-то неще.
етого и скрипта:
мерси предварително
Код:
Warning: Wrong parameter count for mkdir() in c:\apache\htdocs\exe\uploadexe.php on line 15
upload_files directory doesn't exist and creation failed
етого и скрипта:
Код:
<?php
@session_start();
$site_name = $_SERVER['HTTP_HOST'];
$url_dir = "http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']);
$url_this = "http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
$upload_dir = "files/";
$upload_url = $url_dir."/files/";
$message ="";
/************************************************************
* Create Upload Directory
************************************************************/
if (!is_dir("files")) {
if (!mkdir($upload_dir))
die ("upload_files directory doesn't exist and creation failed");
if (!chmod($upload_dir,0755))
die ("change permission to 755 failed.");
}
/************************************************************
* Process User's Request
************************************************************/
if ($_REQUEST[del]) {
print "<script>window.location.href='$url_this?message=deleted successfully'</script>";
}
else if ($_FILES['userfile']) {
$message = do_upload($upload_dir, $upload_url);
print "<script>window.location.href='$url_this?message=$message'</script>";
}
else if (!$_FILES['userfile']);
else
$message = "Invalid File Specified.";
/************************************************************
* List Files
************************************************************/
$handle=opendir($upload_dir);
$filelist = "";
while ($file = readdir($handle)) {
if(!is_dir($file) && !is_link($file)) {
$filelist .= "<br><a href='$upload_dir$file'>".$file."</a>";
}
}
function do_upload($upload_dir, $upload_url) {
$temp_name = $_FILES['userfile']['tmp_name'];
$file_name = $_FILES['userfile']['name'];
$file_type = $_FILES['userfile']['type'];
$file_size = $_FILES['userfile']['size'];
$result = $_FILES['userfile']['error'];
$file_url = $upload_url.$file_name;
$file_path = $upload_dir.$file_name;
//File Name Check
if ( $file_name =="") {
$message = "Invalid File Name Specified";
return $message;
}
//File Size Check
else if ( $file_size > 999999999999999999999) {
print $file_size;
$message = "Размера на файла е много голям.";
return $message;
}
//File Type Check
else if ( $file_type == "text/plain"
|| $file_type == "application/force-download"
|| $file_type == "application/octet-stream") {
$message = "Sorry, You cannot upload any script file" ;
return $message;
}
$result = move_uploaded_file($temp_name, $file_path);
if (!chmod($file_path,0755))
$message = "change permission to 755 failed.";
else
$message = ($result)?"$file_name($file_type) uploaded successfully." :
"Somthing is wrong with uploading a file.";
return $message;
}
?>
<table style="width: 40%" align="center" valign="top"><tr><td align="center">
<img src="mute.gif"/></td></tr>
<tr>
<td><br>
<div align="center" style="font-size: 19px; font-weight: bold">
</table>
<body bgcolor="#667987"><center>
<font color=red><?=$_REQUEST[message]?></font>
<br>
<form name="upload" id="upload" ENCTYPE="multipart/form-data" method="post">
Качи фаил: <input type="file" id="userfile" name="userfile">
<input type="submit" name="upload" value="Upload">
</form>
<br>
<br><b>До сега потребителите ни са качили следните файлове:</b>
<hr style="color:yellow; background-color:black; height:1px;
margin-right:0; text-align:right; border:0px">
<?=$filelist?>
</center>
<?
if ($_REQUEST[debug]==1) print "------------------Debugging Info----------------<br>";
if ($_REQUEST[debug]==1) print "site=$site_name<br>dir=$url_dir<br>url=$url_this<br>";
if ($_REQUEST[debug]==1) print "upload dir=$upload_dir<br>upload url=$upload_url<br>";
?>