יש לי את הקוד הבא :
הוא מעלה את הקובץ אבל בשם
file_$idעכשיו אני רוצה שישמור בשם של הקובץ המקורי שהעלאתי משום מה אני לא מצליח לשנות את זה מישהו יכול בבקשה לעזור לי ?
תודה רבה 
<? include "header.php"; include "middle.php"; if (isset($_POST)) { for ($i=0;$i<5;$i++) { $post_ok = true; $name = $_FILES; $arr_name = explode(".",$name); $type = strtolower($arr_name); $size = $_FILES; $errors = NULL; if ($name != NULL) { if (($type == "php") or ($type == "bat")) { $errors .= "אינך רשאי לעלות קובץ מסוג זה!<br />"; $post_ok = false; } if ($size > 520000042880) { $errors .= "אינך רשאי לעלות קובץ מעל 50 מגה<br />"; $post_ok = false; } if ($_POST == "-1") { $errors .= "אנא בחר הרשאה לקובץ<br />"; $post_ok = false; } if ($post_ok) { $temp = $_FILES; mysql_query("insert into files (userid,size,description,permit,time) values (".$_GET.",".$size.",'".$_POST."',".$_POST.",".time().")") or die("MySQL Error:".mysql_error()); $file_id = mysql_insert_id(); $arr_name = explode(".",$name); $new_name = "images/uploads/file_".$file_id.".".$arr_name; move_uploaded_file($temp,$new_name); chmod($new_name, 0777); mysql_query("update files set name='".$new_name."' where id=".$file_id."") or die("MySQL Error: ".mysql_error()); ?> <script type="text/javascript"> alert("הפעולה בוצעה בהצלחה!"); document.location = "folder.php?user=<?=$user?>"; </script> <? }else{ ?> <table class="details" cellpadding="5" cellspacing="0"> <tr> <td class="details_title"><img src="../images/icons/cross.png" align="top" alt="" /> בדוק את השגיאות הבאות:</td> </tr> <tr> <td><?=$errors?></td> </tr> </table><br /> <? } } } } ?> <form action="" method="post" enctype="multipart/form-data"> <table cellpadding="5" cellspacing="0" width="100%"> <? for ($i=0;$i<5;$i++) {?> <tr> <td valign="top">בחר קובץ: <br /><input id="file" size="15" type="file" name="file" /></td> <td valign="top">תיאור: <br /><input type="text" name="description" size="50" maxlength="255" value="<?=$_POST?>" /><br /><span style="font-size:9px;">(עד 255 תווים)</span></td> <td valign="top">הרשאות: <br /> <select name="permit"> <option value="">בחר</option> <option value="0" <? if ($_POST == 0) {?> selected="selected"<? } ?>>כולם</option> <option value="1" <? if ($_POST == 1) {?> selected="selected"<? } ?>>רשומים</option> <option value="2" <? if ($_POST == 2) {?> selected="selected"<? } ?>>מנהל</option> </select> </td> </tr> <? } ?> <tr> <td colspan="3"><input type="submit" value="התחל העלאה" name="upload_file" /></td> </tr> </table> </form> <? include "footer.php"; ?>
|
www.MizrahitClub.co.il
-> מזרחית קלאב - הבית החם של המוסיקה המזרחית.