PDA

View Full Version : مشکل در آپلود



Mohammad-tashi
جمعه 01 آبان 1394, 08:08 صبح
باسلام و تقدیم احترام
من میخام از یکفرم دو فایل رو آپلود کنم گه قراره هرفایلی در یک پوشه خاص بره (البته فعلا هردو رو یکی گذاشتم)
سوال من اینجاست که چرا کد پایین ارر میده
هرچی نگاه میکنم مشکلی نداره...



<a href="#newvid" id="jointop"><input type="button" value="درج ویدئو جدید" class="blue"/></a>
<br/>
<!---- POPUP #2 ----->
<a href="#x" class="overlay" id="newvid"></a>
<div class="box">

<?php
$target_path1 = "vid/";
$target_path2 = "vid/";

$target_path1 = $target_path1 . basename( $_FILES['file1']['name']);

$target_path2 = $target_path2 . basename( $_FILES['file2']['name']);

if(move_uploaded_file($_FILES['file1']['tmp_name'], $target_path1)) {
echo "<p>The file 1". basename( $_FILES['file1']['name']).
" has been uploaded</p>";
} else{
echo "<p>There was an error uploading the file, please try again!</p>";
}

if(move_uploaded_file($_FILES['file2']['tmp_name'], $target_path2)) {
echo "<p>The file ". basename( $_FILES['file2']['name']).
" has been uploaded</p>";
} else{
echo "<p>There was an error uploading the file, please try again!</p>";
}



?>





<form id="form1" name="form1" method="post" action="" enctype="multipart/form-data">
<table width="300" border="0" cellspacing="3" cellpadding="3">
<tr>
<td colspan="2">Dual Upload in 2 addresses</td>
</tr>
<tr>
<td width="80">File 1 :</td>
<td width="199"><input type="file" name="file1" id="file1" /></td>
</tr>
<tr>
<td>File 2 :</td>
<td><input type="file" name="file2" id="file2" /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" name="submit1234" value="Submit" /></td>
</tr>
</table>
</form>


دوبار این ارر چاپ میشه

There was an error uploading the file, please try again

لطفا راهنمایی نمایید

Mohammad-tashi
جمعه 01 آبان 1394, 14:52 عصر
دوستان میشه یک نگاهی بیندازید؟

hsgpro
جمعه 01 آبان 1394, 19:59 عصر
سلام
خروجی دستور زیر رو ارسال کن:
در خروجی این دستور اگه اخطاری وجود داشته باشه جلوی متن error عدد اخطار رو می نویسه.



echo print_r($_FILES);


خروجی error هر عددی بود در این لینک http://php.net/manual/en/features.file-upload.errors.php می تونید بفهمید اخطارش چیه.

beliefsavior
یک شنبه 03 آبان 1394, 22:45 عصر
اینطوری استفاده کنن ببین درست میشه ؟





if (is_uploaded_file($_FILES['uploadedfile']['tmp_name'])) {