הוסטס - פורום אחסון האתרים הגדול בישראל

הוסטס - פורום אחסון האתרים הגדול בישראל (https://hosts.co.il/forums/index.php)
-   פורום תיכנות (https://hosts.co.il/forums/forumdisplay.php?f=14)
-   -   php | uploading pics (https://hosts.co.il/forums/showthread.php?t=60549)

Labs 01-03-08 17:39

php | uploading pics
 
first of all sorry for the english

i biult a script using php
on my godady paid server (php 5)

and every time i submit the script i get an error
- "please choose a picture"
חובה לבחור תמונה";

PHP קוד:

case "add2":
$name=$_POST['name'];
$name=space($name);
$year=$_POST['year'];
$tech=$_POST['tech'];
$gid=$_POST['gid'];
//upload pics
$file_ext_allow = array("gif","jpg","jpeg","png","JPG","JPEG","GIF","PNG");
$dottt=".";
// ראשי
$file_name = $HTTP_POST_FILES['mainpic']['name'];
ECHO "$file_name";
if ($file_name!="") {
$msiu=getlast($file_name);
$new_file_name=$name.$dottt.$msiu;
$path= "../pics/".$new_file_name;
for($i=0;$i<count($file_ext_allow);$i++)
        {
            if (getlast($file_name)!=$file_ext_allow[$i])
                $test.="~~";
        }
$exp=explode("~~",$test);
        if (count($exp)!=(count($file_ext_allow)+1))
        {
if(copy($HTTP_POST_FILES['mainpic']['tmp_name'], $path))
{
// end upload pics
//num id
$numid = mysql_query("select * from `pics`"); 
$numid = mysql_num_rows($numid);
if ($numid=="") {
$id=1;
} else {
$y=0;
for ($ii=1;$ii<=$numid;$ii++) {
$nuum = mysql_query("select * from `pics` WHERE `id`= '$ii'"); 
$nuum = mysql_num_rows($nuum);
if ($nuum=="") {
$id=$ii;
$ii=999999999999;
$y=1;
}
}
if ($y==0) {
$id=$numid+1;
}
}
// end num id
$add = "INSERT INTO pics (id, name, gid, year, tech, pic) VALUES ('$id', '$name', '$gid', '$year', '$tech', '$msiu')";
mysql_query($add);
$succ="התמונה הוספה בהצלחה";
} else {
$succ="בעיה בהעלאת התמונה";
}
} else {
$succ="סיומת אסורה";
}
} else {
$succ="חובה לבחור תמונה";
}
case "add":
?>
    <div class="content">
        <span class="title">הוספת תמונה</span>
        <div class="cont">
<?=$succ?>
<form method="post" enctype="multipart/form-data" id="regf" action="pics.php?a=add2">
<table width="100%">
<tr><td width="120">שם :</td><td><input type="text" name="name" style="width: 400px;" dir="ltr" value="" /></td></tr>
<tr><td width="120">גלריה :</td><td>
<select name="gid" style="width: 400px;">
<option selected="selected" value="0">dl o</option>
</select>
</td></tr>
<tr><td width="120">טכניקה :</td><td><input type="text" name="tech" style="width: 400px;" dir="ltr" value="Oil" /></td></tr>
<tr><td width="120">שנת יצירה :</td><td><input type="text" name="year" style="width: 400px;" dir="ltr" value="" /></td></tr>
<tr><td width="120">תמונה :</td><td><input type="file" name="mainpic" style="width: 400px;" /></td></tr>
</table>
<br />
<input type="submit" name="submit" value="סע >>" class="butt" />
</form>
        </div><br /><br />
    </div>



כל הזמנים הם GMT +2. הזמן כעת הוא 18:07.

מופעל באמצעות VBulletin גרסה 3.8.6
כל הזכויות שמורות ©
כל הזכויות שמורות לסולל יבוא ורשתות (1997) בע"מ