hi all,
i have created a code for uploading picture files and it works perfectly in firefix but in IE 6 or 7 it gives me this error :
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpFuOidl' to '' in /home/site/public_html/upload.php on line 75
error in saving file
my code is after clearing it from spaces :
<?
require("functions.php");
if($_POST["submit"]){
$upload_file;
$msg = "";
if($_FILES["userfile"] == ""){
$upload_file = false;
$msg .= "please select a picture file to upload .<br>";
}else{
$userfile = $_FILES["userfile"];
$userfile_name = $_FILES["userfile"]["name"];
$userfile_size = $_FILES["userfile"]["size"];
$userfile_type = $_FILES["userfile"]["type"];
}
if(!($userfile_type == "image/jpg" or $userfile_type == "image/jpeg" or $userfile_type == "image/png" or $userfile_type == "image/gif")){
$msg .= "<br>extension allowed only : jpg & jpeg & gif & png";
$upload_file = false;
}else{
$upload_file = true;
}
if($userfile_size > 1024000){
$msg .= "max file size is : 1024 KB";
$upload_file = false;
}else{
$upload_file = true;
}
$path = "upload/".next_file_name().".jpg";
// next_file_name() is function that gets the new name from the BataDase
if($upload_file == false){
echo $msg;
}else{
if(move_uploaded_file($userfile["tmp_name"], $path)){// line 75 in the original code where the error pointing
echo "<br>";
echo "file uploaded successfuly";
chmod("{$path}",0777);
}else{
echo "error in saving file";
}
}
?>
the html form is :
<form action="upload.php" method="post" enctype="multipart/form-data" >
<table align="center" border="0" cellspacing="10">
<tr>
<td>choose a picture : </td>
<td><input name="userfile" type="file" size="50" /></td>
</tr>
<tr>
<td colspan="2" align="center">
<input name="submit" value="upload" type="submit"/>
</td>
</tr>
</table>
</form>
please i need help this code is again run perfectly in Firefox but in IE i don't know