walid
11-01-2013, بتوقيت غرينيتش 09:57 AM
http://www.dzbatna.com/images/icons/iconrote.gif ط§ط±ط¬ظˆظƒظ… ط³ط§ط¹ط¯ظˆظ†ظٹ ط§ط±ط¬ظˆظƒظ… (http://www.dzbatna.com/t698439/)
بسم الله
انا نويت اعمل اسكريبت script تحميل http://www.dzbatna.com/images/smilies/bleh.gif لاني بصراحة ملقيتش اسكربت حلو http://www.dzbatna.com/images/smilies/tears.gif
تمام
عايز شرح طريقة للدالة str_replace http://www.dzbatna.com/images/smilies/blushing.gif
لانها اساس الاستخدام http://www.dzbatna.com/images/smilies/crazy.gif
+ كيف احدد + اغير اسم الملف المروفع لان الكود code البسيط
دة كبداية ممتاز
رمز PHP:
<code style="white-space:nowrap"> <code> [center]$upload_path = './files/';
?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>ok</title>
</head>
<?
$filename = $_FILES['userfile']['name']; // Get the name of the file (including file extension).
$ext = substr($filename, strpos($filename,'.'), strlen($filename)-1);
$filename = str_replace('http://','%%',$filename);
$filename = str_replace('//','/',$filename);
$filename = str_replace('%%','http://',$filename);
$filename = str_replace('/A-Z/','httpeda',$filename);
// Get the extension from the filename.
if(!in_array($ext,$allowed_filetypes))
die('The file you attempted to upload is not allowed.');
if(filesize($_FILES['userfile']['tmp_name']) >= $max_filesize)
die('The file you attempted to upload is too large.');
if(!is_writable($upload_path))
die('You cannot upload to the specified directory, please CHMOD it to 777.');
if(move_uploaded_file($_FILES['userfile']['tmp_nam e'],$upload_path . $filename))
echo 'Your file upload was successful, view the file <a href="'.$upload_path.$filename.'" title="Your File">here</a>';
else
echo 'There was an error during the file upload. Please try again.';
[/center] </code> </code>
عايز الملف المفوع يتحفظ في مكانة بس يكون اسمة مثلا 123456 يعني ارقام و حروف بس ما يكون فية امتداد http://www.dzbatna.com/images/smilies/crazy.gif
يا رب حد يساعدني http://www.dzbatna.com/images/smilies/nosweat.gif
و شكرا مقدما http://www.dzbatna.com/images/smilies/1eye.gif
التعديل الأخير كان بواسطة sup0zero; 24 - 01 - 2014 الساعة 20:56
ألعاب الأندرويد مجانا و حصريا (http://www.apotox.info/forum)
https://fbcdn-sphotos-d-a.akamaihd.net/hphotos-ak-ash4/482113_236967293114455_1193518507_n.png (http://www.dzbatna.com)
©المشاركات المنشورة تعبر عن وجهة نظر صاحبها فقط، ولا تُعبّر بأي شكل من الأشكال عن وجهة نظر إدارة المنتدى (http://www.dzbatna.com)©
بسم الله
انا نويت اعمل اسكريبت script تحميل http://www.dzbatna.com/images/smilies/bleh.gif لاني بصراحة ملقيتش اسكربت حلو http://www.dzbatna.com/images/smilies/tears.gif
تمام
عايز شرح طريقة للدالة str_replace http://www.dzbatna.com/images/smilies/blushing.gif
لانها اساس الاستخدام http://www.dzbatna.com/images/smilies/crazy.gif
+ كيف احدد + اغير اسم الملف المروفع لان الكود code البسيط
دة كبداية ممتاز
رمز PHP:
<code style="white-space:nowrap"> <code> [center]$upload_path = './files/';
?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>ok</title>
</head>
<?
$filename = $_FILES['userfile']['name']; // Get the name of the file (including file extension).
$ext = substr($filename, strpos($filename,'.'), strlen($filename)-1);
$filename = str_replace('http://','%%',$filename);
$filename = str_replace('//','/',$filename);
$filename = str_replace('%%','http://',$filename);
$filename = str_replace('/A-Z/','httpeda',$filename);
// Get the extension from the filename.
if(!in_array($ext,$allowed_filetypes))
die('The file you attempted to upload is not allowed.');
if(filesize($_FILES['userfile']['tmp_name']) >= $max_filesize)
die('The file you attempted to upload is too large.');
if(!is_writable($upload_path))
die('You cannot upload to the specified directory, please CHMOD it to 777.');
if(move_uploaded_file($_FILES['userfile']['tmp_nam e'],$upload_path . $filename))
echo 'Your file upload was successful, view the file <a href="'.$upload_path.$filename.'" title="Your File">here</a>';
else
echo 'There was an error during the file upload. Please try again.';
[/center] </code> </code>
عايز الملف المفوع يتحفظ في مكانة بس يكون اسمة مثلا 123456 يعني ارقام و حروف بس ما يكون فية امتداد http://www.dzbatna.com/images/smilies/crazy.gif
يا رب حد يساعدني http://www.dzbatna.com/images/smilies/nosweat.gif
و شكرا مقدما http://www.dzbatna.com/images/smilies/1eye.gif
التعديل الأخير كان بواسطة sup0zero; 24 - 01 - 2014 الساعة 20:56
ألعاب الأندرويد مجانا و حصريا (http://www.apotox.info/forum)
https://fbcdn-sphotos-d-a.akamaihd.net/hphotos-ak-ash4/482113_236967293114455_1193518507_n.png (http://www.dzbatna.com)
©المشاركات المنشورة تعبر عن وجهة نظر صاحبها فقط، ولا تُعبّر بأي شكل من الأشكال عن وجهة نظر إدارة المنتدى (http://www.dzbatna.com)©