
Kod skryptu:
Kod
<center><?php
//edit this
$_max_file_size = '1000000'; //file size in bytes.
$upload_dir = "upload/"; //upload folder..chmod to 777
$_i = "1"; //number of files to upload at one time
//end edit
echo "";
echo "<form enctype='multipart/form-data' action='?do=upload' method='post'>";
echo "<input type='hidden' name='MAX_FILE_SIZE' value='" . $_max_file_size , "'>";
echo "";
//show number of files to select
For($i=0; $i <= $_i-1;$i++)
{
echo "<input name='file" . $i . "' type='file'size='25'>";
}
echo "<input type='submit' value='Upload System'><br>";
"</form>";
if($_GET['do'] == 'upload')
{
//upload all the fields until done
For($i=0; $i <= $_i-1; $i++)
{
//create a random number
$_random = rand(1, 1000000);
//file with the upload folder
$_file_name = $_random . basename($_FILES['file' . $i]['name']);
$tab = explode('.', $_file_name);
$nazwa = $tab[count($tab)-1];
$target_path = ("$upload_dir$_random.$nazwa");
//actual file name with the random number
//do not upload the 'left blank' fields
if(basename($_FILES['file' . $i]['name']) != '')
{
if(move_uploaded_file($_FILES['file' . $i]['tmp_name'], $target_path))
{
//uploaded successfuly
$_uploaded=1;
}
else
{
//error uploading
$_error=1;
}
}
else
{
$_check=$_check+1;
}
}
//file(s) did upload
if($_uploaded == '1')
{
$_uploaded=0;
echo "<input type='text'value='http://rufus.ifastnet.com/upload/$_random.$nazwa'size='60'>";
}
//file uploaded?
if($_error == '1')
{
$_error=0;
echo "";
}
//user selected a file?
if($_check == $_i)
{
$_check=0;
echo "";
}
}
?></center>
//edit this
$_max_file_size = '1000000'; //file size in bytes.
$upload_dir = "upload/"; //upload folder..chmod to 777
$_i = "1"; //number of files to upload at one time
//end edit
echo "";
echo "<form enctype='multipart/form-data' action='?do=upload' method='post'>";
echo "<input type='hidden' name='MAX_FILE_SIZE' value='" . $_max_file_size , "'>";
echo "";
//show number of files to select
For($i=0; $i <= $_i-1;$i++)
{
echo "<input name='file" . $i . "' type='file'size='25'>";
}
echo "<input type='submit' value='Upload System'><br>";
"</form>";
if($_GET['do'] == 'upload')
{
//upload all the fields until done
For($i=0; $i <= $_i-1; $i++)
{
//create a random number
$_random = rand(1, 1000000);
//file with the upload folder
$_file_name = $_random . basename($_FILES['file' . $i]['name']);
$tab = explode('.', $_file_name);
$nazwa = $tab[count($tab)-1];
$target_path = ("$upload_dir$_random.$nazwa");
//actual file name with the random number
//do not upload the 'left blank' fields
if(basename($_FILES['file' . $i]['name']) != '')
{
if(move_uploaded_file($_FILES['file' . $i]['tmp_name'], $target_path))
{
//uploaded successfuly
$_uploaded=1;
}
else
{
//error uploading
$_error=1;
}
}
else
{
$_check=$_check+1;
}
}
//file(s) did upload
if($_uploaded == '1')
{
$_uploaded=0;
echo "<input type='text'value='http://rufus.ifastnet.com/upload/$_random.$nazwa'size='60'>";
}
//file uploaded?
if($_error == '1')
{
$_error=0;
echo "";
}
//user selected a file?
if($_check == $_i)
{
$_check=0;
echo "";
}
}
?></center>