
06-06-2006, 21:30
|
|
|
|
חבר מתאריך: 27.04.06
הודעות: 11
|
|
|
עזרה בקשר לשיפור מערכת העלאת קבצים.
שלום, יש לי מערכת העלאת קבצים חינמית, ואני צריך עזרה בלשפר אותה.
יש במערכת קובץ אחד (למעט הקבצי העיצוב, כגון: הלוגו, והCSS), ושמו Uploader.php
קוד שלו הוא:
קוד PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>HD Uploader</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="stylesheet.css" rel="stylesheet" type="text/css"> </head> <body> <table width="100%" cellspacing="2" cellpadding="2" height="100%"> <tr> <td> <div align="center"> <table width="550" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#336699"> <tr> <td background="top.gif" height="60"><img src="head.gif" width="256" height="45"></td> </tr> <tr> <td background="bg.gif"><table width="100%" cellpadding="5" cellspacing="5"> <tr> <td background="bg.gif"> <form name="formen" action="uploader.php" method="post" enctype="multipart/form-data"> You can upload to the folders: uploaded_pics, uploaded_files and uploaded_docs.<br> This scripts uploads only: *.jpg, *.gif *.png *.exe *.zip *.rar and *.html<br> You must give the file a name on the server. Do not forget the ending.<br> Max filesize: 1000kb. <br> <br> <table width="100%" cellspacing="2" cellpadding="2"> <tr> <td width="180" background="bg.gif">File: </td> <td background="bg.gif"> <input type="file" name="bilde_fil"> </td> </tr> <tr> <td width="180" background="bg.gif">Choose folder:</td> <td background="bg.gif"> <select name="folder"> <option>Choose folder</option> <option value="uploaded_pics/">Uploaded Pics</option> <option value="uploaded_files/">Uploaded Files</option> <option value="uploaded_docs/">Uploaded Docs</option> </select> </td> </tr> <tr> <td width="180" background="bg.gif">Name of the file on the server:</td> <td background="bg.gif"> <input type="text" name="nyttnavn"> </td> </tr> <tr> <td width="180" background="bg.gif">Filetype:</td> <td background="bg.gif"> <select name="ending"> <option>.jpg</option> <option>.png</option> <option>.gif</option> <option>.exe</option> <option>.zip</option> <option>.rar</option> <option>.ace</option> <option>.html</option> </select> </td> </tr> </table> <br> <input type="submit" value="Upload" name="submit"> <input type="hidden" name="MAX_FILE_SIZE" value="1000000"> <?php if ($folder == "Choose folder") { echo "<b>Error: </b> You must Choose a folder to upload your file."; }?> <?php #Config $path=$folder; //The file-path(remember the last '/') #Do not edit below :) if ($bilde_fil && $nyttnavn){ $ok = 1; if (is_file($path.$nyttnavn.$ending)){ print "<b>Error</b>, the name allready exists. Choose another name.<br>"; $ok = 0; } if (preg_match("/^[\/\\\.]/", $nyttnavn)){ print "<b>Error</b>, Filname can't start with: '.', '/' or '\'"; $ok = 0; } if (!($ending == ".jpg" || $ending == ".gif" || $ending == ".zip" || $ending == ".exe" || $ending == ".rar" || $ending == ".html" || $ending == ".ace" || $ending == ".png")){ print "<b>Error</b>, do not mix with the filename ($ending) Thanks!"; $ok = 0; } print ""; } if ($ok){ $res = copy($bilde_fil, $path."/".$nyttnavn.$ending); print ($res)?"<b>Finish</b>, uploadet ".$nyttnavn.$ending."":"<b>Error</b>, could not upload the file.<br>"; print ""; } ?> <font color="#FFFFFF"></font><br> </form> </td> </tr> </table> </td> </tr> <tr> <td height="37"> <table width="100%" cellspacing="0" cellpadding="0"> <tr> <td height="37" background="bottom.gif"> <div align="center">All Rights Reserved. <a href="http://www.harlemdesigns.org">Harlem Designs</a> are Free Softwares.<br> Copyright Harlem Designs ©2001-2003</div> </td> </tr> </table> </td> </tr> </table> <p class="headcell"> </p> </div> </td> </tr> </table> </body> </html>
עכשיו, הייתי רוצה, לגרום למערכת להעלאות את הקבצים לתיקייה אחת (שלא יבחרו), ושלקובץ יהיה שם שישתנה, ושם את השם לא יבחרו.
כמו כאן:
Up-f.net
תודה רבה לעזורים!!
|