سلام
من کد زیر رو برای آپلود عکسها پیدا کردم:
کد PHP:
<?php

// Your file name you are uploading
$file_name $HTTP_POST_FILES['ufile']['name'];
// random 4 digit to add to our file name
// some people use date and time in stead of random digit
$random_digit=rand(0000000000,999999999);

//combine random digit to you file name to create new file name
//use dot (.) to combile these two variables

$new_file_name=$random_digit.$file_name;

//set where you want to store files
//in this example we keep file in folder upload
//$new_file_name = new upload file name
//for example upload file name cartoon.gif . $path will be upload/cartoon.gif
$path"upload/".$new_file_name;
if(
$ufile !=none)
{
if(
copy($HTTP_POST_FILES['ufile']['tmp_name'], $path))
{
echo 
"Successful<BR/>";

//$new_file_name = new file name
//$HTTP_POST_FILES['ufile']['size'] = file size
//$HTTP_POST_FILES['ufile']['type'] = type of file
echo "File Name :".$new_file_name."<BR/>";
echo 
"File Size :".$HTTP_POST_FILES['ufile']['size']."<BR/>";
echo 
"File Type :".$HTTP_POST_FILES['ufile']['type']."<BR/>";
}
else
{
echo 
"Error";
}
}
?>
چطوری میتونم برای آپلود فقط از نام رندوم + پسوند فایل استفاده کنم؟


یه سوال اضافه: چطوری میشه برای هر بار آپلود بین چندتا فولدر یکیشون رو برای آپلود انتخاب کنه؟

این هم کد html فرم آپلودش هست:
کد PHP:
<table width="500" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<
tr>
<
form action="upload.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
<
td>
<
table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<
tr>
<
td><strong>Single File Upload </strong></td>
</
tr>
<
tr>
<
td>Select file
<input name="ufile" type="file" id="ufile" size="50" /></td>
</
tr>
<
tr>
<
td align="center"><input type="submit" name="Submit" value="Upload" /></td>
</
tr>
</
table>
</
td>
</
form>
</
tr>
</
table

پ.ن: بماند که برای یوزر فریندلی بودن کلی کار داره اما اول میخوام نوع آپلود رو تعیین کنم