ordebehesht
Member
دوستان من کد زیر رو برای آپلود فایل نوشتم ولی تو خط 33 فایل upload.php خطا می گیره
کد html
کد php:
متن خطا
دیگه احتیاج نیست)
مشکل از کجاست مرسی
خودم مشکل رو حل کردم تغیری در خط 32 می دم امیدوارم دوس تان لز این اسکریپت استفاده کنند
کد html
کد:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta name="author" content="phpDesigner7" />
<title>Administration - upload new file</title>
</head>
<body>
<h1>uploade new news files</h1>
<form action="upload.php" method="post" enctype="multipart/form-data">
<input type="hidden" value="1000000" name="MAX_FILE_SIZE" />
upload this file: <input type="file" size="20" name="userfile" />
<input type="submit" value="Send file" />
</form>
</body>
</html>
کد:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta name="author" content="phpDesigner7" />
<title>Uploading...</title>
</head>
<body>
<h1>Uploading File...</h1>
<?php
if($_FILES['userfile']['error'])
{
echo'problem: ';
switch ($_FILES['userfile']['error'])
{
case 1: echo'File esceede Upload_Max_Filesize'; break;
case 2: echo'File esceede Max_File_Size'; break;
case 3: echo'File only partially uploaded'; break;
case 4: echo'No file uploaded'; break;
}
exit;
}
if($_FILES['userfile']['type']!='text/plain')
{
echo'problem: file is not plain text';
exit;
}
[SIZE=4][COLOR=Red]//change this lin's[/COLOR][/SIZE]
$upfile='upload/';
$upfile = $upfile.$_FILES['userfile']['name'];
if(is_uploaded_file($_FILES['userfile']['tmp_name']))
{
if(!move_uploaded_file($_FILES['userfile']['tmp_name'],$upfile))
{
echo 'problem: Could not move file to Distination Directory';
exit;
}
}
else
{
echo'problem: Possible file upload attack. Filename:';
echo $_FILES['userfile']['name'];
exit;
}
echo 'File uploaded succesfully</br></br>';
$fp=fopen($upfile,'r');
$contents=fread($fp,filesize($upfile));
fclose($fp);
$contents=strip_tags($contents);
$fp=fopen($upfile,'w');
fwrite($fp,$contents);
fclose($fp);
echo 'Preview of uploaded file contents: <br><hr>';
echo $contents;
echo'<br><hr>'
?>
</body>
</html>
کد:
[B]Warning[/B]: move_uploaded_file(/uploads/samay.txt) [[URL="http://localhost/Alias/function.move-uploaded-file"]function.move-uploaded-file[/URL]]: failed to open stream: No such file or directory in [B]E:\wamp\www\Alias\upload.php[/B] on line [B]33[/B]
[B]Warning[/B]: move_uploaded_file() [[URL="http://localhost/Alias/function.move-uploaded-file"]function.move-uploaded-file[/URL]]: Unable to move 'E:\wamp\tmp\php705.tmp' to '/uploads/samay.txt' in [B]E:\wamp\www\Alias\upload.php[/B] on line [B]33[/B]
problem: Could not move file to Distination Directory

خودم مشکل رو حل کردم تغیری در خط 32 می دم امیدوارم دوس تان لز این اسکریپت استفاده کنند

آخرین ویرایش: