Szerző Téma: .zip feltöltõ rendszer weboldalba/ra.  (Megtekintve 773 alkalommal)

[PlayZone]Rulexface

  • Vendég
.zip feltöltõ rendszer weboldalba/ra.
« Dátum: 2012. április 26. - 17:08:23 »
0 Show voters
Heló! Nos egyre többen küldenének mapot a szerverembe és nem tudok mindíg otthon lenni stb meg fogadgatni õket nos gondoltam h beépítek a weboldalba egy mapfeltõltõt annyiból állna hogy max 20 mb lehet a feltölteni való cucc és kicsit h ne lehessen feltölteni pl /feltolto/index.php n töltik fel és /feltolto/map/mapok szal ezt az url t a többiek nem tudnák mert akkor ellophatják mások mapját és valaki tud e ehez a projekthez egy alap kódot adni? vagy egy komlett cuccot akár:) Köszii

.zip feltöltõ rendszer weboldalba/ra.
« Válasz #1 Dátum: 2012. április 26. - 17:09:04 »
0 Show voters
FTP?

[PlayZone]Rulexface

  • Vendég
.zip feltöltõ rendszer weboldalba/ra.
« Válasz #2 Dátum: 2012. április 26. - 17:09:48 »
0 Show voters
Idézetet írta: James_Raynor date=1335452944\" data-ipsquote-contentapp=\"forums\" data-ipsquote-contenttype=\"forums\" data-ipsquote-contentid=\"20655\" data-ipsquote-contentclass=\"forums_Topic
FTP?
 
neeem hanem egy oldalt pl beépítek az smf be mint pl egy képfeltöltõ egy feltöltõ rendszer.. így mondom :)

.zip feltöltõ rendszer weboldalba/ra.
« Válasz #3 Dátum: 2012. április 26. - 17:32:10 »
0 Show voters
Ilyen találtam:
Majd írd át az adatokat!
 

index.php fájl:

 
<html>
<head>
<title>Schumi - Upload Form</title>
<script type=\"text/javascript\">
function UpMutat(id) {
var e = document.getElementById(id);
if(e.style.visibility == \'visible\')
  e.style.visibility = \'hidden\';
else
  e.style.visibility = \'visible\';
}
</script>
<style type=\"text/css\">
<!--
html, body {
background-color: #000000;
height: 100%;
padding: 0;
margin: 0;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 14px;
color: #FFFFCC;
}
 
.upstyle {
position:absolute;
width:99%;
height: 98%;
z-index:1;
left: 0px;
top: 0px;
background-color: #000000;
border-style: solid;
border-width: 3px;
border-color: FFFFCC;
overflow: visible;
visibility: hidden;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 21px;
color: #FFFFCC;
}
-->
</style>
</head>
<body>
<div align=\"center\" class=\"upstyle\" id=\"uploading\">
<p align=\"center\"><br><br><b>Uploading file(s)!<br><br>Please wait!</p>
</div>
<center>
<p>Upload files here, 5 files at a time. (512 MB/file, 1024 MB MAX)</p>
<p>
<form name=\"fileup\" method=\"post\" enctype=\"multipart/form-data\" action=\"upload.php\">
<input type=\"file\" name=\"userfiles[]\" size=\"70\"><br><br>
<input type=\"file\" name=\"userfiles[]\" size=\"70\"><br><br>
<input type=\"file\" name=\"userfiles[]\" size=\"70\"><br><br>
<input type=\"file\" name=\"userfiles[]\" size=\"70\"><br><br>
<input type=\"file\" name=\"userfiles[]\" size=\"70\"><br><br>
<br>
<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"5120000000\">
<input type=\"submit\" id=\"sub\" value=\"submit\" name=\"submit\" onclick=\"UpMutat(\'uploading\');\">
</form>
</center>
</body>
</html>

 
upload.php fájl:
 
<html>
<body bgcolor=\"000000\">
<center>
<font face=\"verdana\" size=\"3\" color=\"FFFFCC\">
<?
//uses $_FILES[] global array
//see manual for older PHP version info
//This function will be used to get the extension from the filename
Function get_extension($file,$length=-1){
$p = strrpos($file,\".\");
$p++;
If($length!=-1){
$ext = substr($file,$p,$length);
}
If($length==-1){
$ext = substr($file,$p);
}
$ext = strtolower($ext);
Return $ext;
}
//Not good practice, but here anyway
//change to suit your needs
//also some have to be set in the ini
//for this to correctly work
//512 MB max. méret
Ini_set(\"upload_max_filesize\",\"512M\");
//turn on file uploads
Ini_set(\"file_uploads\",\"1\");
//set your temp dir
Ini_set(\"upload_tmp_dir\",\"/temp\");
//set post size large enough to accomidate
//3 100meg files and some overhead
Ini_set(\"post_max_size\",\"1024M\");
?>
</p>
<?
//check to see if we have submited yet
If($_POST[\"submit\"]!=\"submit\"){
//not yet so lets make the form
?>
<?
}
//see if we have submited and that the files array has been set
If(($_POST[\"submit\"]==\"submit\")&&(is_array($_FILES[\'userfiles\']))){
$ftp_user_name=\"[email protected]\"; //change to ftp username
$ftp_user_pass=\"valami_jelszo\"; //change to ftp password
$ftp_server=\"ftp.valami.hu\"; //change to ftp url
$ftp_dump_dir=\"/uploaded_files\"; //change to destination directory
//go through all the files
For($x=0;$x<count($_FILES[\'userfiles\'][\'name\']);$x++){
//now we do some file checking
//check to see if file is there
If($_FILES[\'userfiles\'][\'name\'][$x]!=\"none\"){
//file has a name
//check filesize
If($_FILES[\'userfiles\'][\'size\'][$x]!=0){
//file is larger than 0 bytes
//Check to see if it is uploaded
If(is_uploaded_file($_FILES[\'userfiles\'][\'tmp_name\'][$x])){
//file has been uploaded!
//let the user know their file has be uploaded
Echo \"File \".$_FILES[\'userfiles\'][\'name\'][$x].\" uploaded successfully!<br><br>\";
//conect to ftp server
$conn_id = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// check connection
If ((!$conn_id) || (!$login_result)) {
Echo \"FTP connection has failed!<br><br>\";
Echo \"Attempted to connect to $ftp_server for user $ftp_user_name\";
Exit;
} else {
Echo \"Connected to $ftp_server! <br><br>\";
//set PASV mode
If(!ftp_pasv($conn_id,TRUE)){
Echo \"Could not enter PASV mode!\";
}
//rename to file#_date.Ext
$filename = $_FILES[\'userfiles\'][\'name\'][$x];
//$filename.= \".\".Get_extension($_FILES[\'userfiles\'][\'name\'][$x],3);
//change directory
//If (@ftp_chdir($conn_id, $ftp_dump_dir)) {
//maybe you want to make sure we are in the correct directory
//Echo \"Current directory is now : \", ftp_pwd($conn_id), \"\\and\";
//} else {
//you want to know if it didn\'t work
//Echo \"Couldn\'t change directory\\and\";
//}
//upload the file and let the user know what happened
If(ftp_put($conn_id,$filename,$_FILES[\'userfiles\'][\'tmp_name\'][$x],FTP_BINARY)){
Echo \"File \".$_FILES[\'userfiles\'][\'name\'][$x].\" was sent successfully<br><br>\";
Echo \"File was named: \".$filename.\"<br>\";
}else{
Echo \"There was a problem sending file \".$_FILES[\'userfiles\'][\'name\'][$x].\"<br><br>\";;
}
}
// close the FTP stream
Ftp_close($conn_id);
}
Else echo\"File was not uploaded!<br><br>\";
}
}
Echo \"<br>\";
}//end for loop
}
//That\'s all folks!
?>
<a href=\"index.php\" target=\"_self\">Back to Upload form!</a>
</font>
</center>
<body>
</html>

[PlayZone]Rulexface

  • Vendég
.zip feltöltõ rendszer weboldalba/ra.
« Válasz #4 Dátum: 2012. április 26. - 17:56:36 »
0 Show voters
Idézetet írta: TheMesziErik date=1335454330\" data-ipsquote-contentapp=\"forums\" data-ipsquote-contenttype=\"forums\" data-ipsquote-contentid=\"20655\" data-ipsquote-contentclass=\"forums_Topic
Ilyen találtam:
Majd írd át az adatokat!
 

index.php fájl:

 
<html>
<head>
<title>Schumi - Upload Form</title>
<script type=\"text/javascript\">
function UpMutat(id) {
var e = document.getElementById(id);
if(e.style.visibility == \'visible\')
  e.style.visibility = \'hidden\';
else
  e.style.visibility = \'visible\';
}
</script>
<style type=\"text/css\">
<!--
html, body {
background-color: #000000;
height: 100%;
padding: 0;
margin: 0;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 14px;
color: #FFFFCC;
}
 
.upstyle {
position:absolute;
width:99%;
height: 98%;
z-index:1;
left: 0px;
top: 0px;
background-color: #000000;
border-style: solid;
border-width: 3px;
border-color: FFFFCC;
overflow: visible;
visibility: hidden;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 21px;
color: #FFFFCC;
}
-->
</style>
</head>
<body>
<div align=\"center\" class=\"upstyle\" id=\"uploading\">
<p align=\"center\"><br><br><b>Uploading file(s)!<br><br>Please wait!</p>
</div>
<center>
<p>Upload files here, 5 files at a time. (512 MB/file, 1024 MB MAX)</p>
<p>
<form name=\"fileup\" method=\"post\" enctype=\"multipart/form-data\" action=\"upload.php\">
<input type=\"file\" name=\"userfiles[]\" size=\"70\"><br><br>
<input type=\"file\" name=\"userfiles[]\" size=\"70\"><br><br>
<input type=\"file\" name=\"userfiles[]\" size=\"70\"><br><br>
<input type=\"file\" name=\"userfiles[]\" size=\"70\"><br><br>
<input type=\"file\" name=\"userfiles[]\" size=\"70\"><br><br>
<br>
<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"5120000000\">
<input type=\"submit\" id=\"sub\" value=\"submit\" name=\"submit\" onclick=\"UpMutat(\'uploading\');\">
</form>
</center>
</body>
</html>

 
upload.php fájl:
 
<html>
<body bgcolor=\"000000\">
<center>
<font face=\"verdana\" size=\"3\" color=\"FFFFCC\">
<?
//uses $_FILES[] global array
//see manual for older PHP version info
//This function will be used to get the extension from the filename
Function get_extension($file,$length=-1){
$p = strrpos($file,\".\");
$p++;
If($length!=-1){
$ext = substr($file,$p,$length);
}
If($length==-1){
$ext = substr($file,$p);
}
$ext = strtolower($ext);
Return $ext;
}
//Not good practice, but here anyway
//change to suit your needs
//also some have to be set in the ini
//for this to correctly work
//512 MB max. méret
Ini_set(\"upload_max_filesize\",\"512M\");
//turn on file uploads
Ini_set(\"file_uploads\",\"1\");
//set your temp dir
Ini_set(\"upload_tmp_dir\",\"/temp\");
//set post size large enough to accomidate
//3 100meg files and some overhead
Ini_set(\"post_max_size\",\"1024M\");
?>
</p>
<?
//check to see if we have submited yet
If($_POST[\"submit\"]!=\"submit\"){
//not yet so lets make the form
?>
<?
}
//see if we have submited and that the files array has been set
If(($_POST[\"submit\"]==\"submit\")&&(is_array($_FILES[\'userfiles\']))){
$ftp_user_name=\"[email protected]\"; //change to ftp username
$ftp_user_pass=\"valami_jelszo\"; //change to ftp password
$ftp_server=\"ftp.valami.hu\"; //change to ftp url
$ftp_dump_dir=\"/uploaded_files\"; //change to destination directory
//go through all the files
For($x=0;$x<count($_FILES[\'userfiles\'][\'name\']);$x++){
//now we do some file checking
//check to see if file is there
If($_FILES[\'userfiles\'][\'name\'][$x]!=\"none\"){
//file has a name
//check filesize
If($_FILES[\'userfiles\'][\'size\'][$x]!=0){
//file is larger than 0 bytes
//Check to see if it is uploaded
If(is_uploaded_file($_FILES[\'userfiles\'][\'tmp_name\'][$x])){
//file has been uploaded!
//let the user know their file has be uploaded
Echo \"File \".$_FILES[\'userfiles\'][\'name\'][$x].\" uploaded successfully!<br><br>\";
//conect to ftp server
$conn_id = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// check connection
If ((!$conn_id) || (!$login_result)) {
Echo \"FTP connection has failed!<br><br>\";
Echo \"Attempted to connect to $ftp_server for user $ftp_user_name\";
Exit;
} else {
Echo \"Connected to $ftp_server! <br><br>\";
//set PASV mode
If(!ftp_pasv($conn_id,TRUE)){
Echo \"Could not enter PASV mode!\";
}
//rename to file#_date.Ext
$filename = $_FILES[\'userfiles\'][\'name\'][$x];
//$filename.= \".\".Get_extension($_FILES[\'userfiles\'][\'name\'][$x],3);
//change directory
//If (@ftp_chdir($conn_id, $ftp_dump_dir)) {
//maybe you want to make sure we are in the correct directory
//Echo \"Current directory is now : \", ftp_pwd($conn_id), \"\\and\";
//} else {
//you want to know if it didn\'t work
//Echo \"Couldn\'t change directory\\and\";
//}
//upload the file and let the user know what happened
If(ftp_put($conn_id,$filename,$_FILES[\'userfiles\'][\'tmp_name\'][$x],FTP_BINARY)){
Echo \"File \".$_FILES[\'userfiles\'][\'name\'][$x].\" was sent successfully<br><br>\";
Echo \"File was named: \".$filename.\"<br>\";
}else{
Echo \"There was a problem sending file \".$_FILES[\'userfiles\'][\'name\'][$x].\"<br><br>\";;
}
}
// close the FTP stream
Ftp_close($conn_id);
}
Else echo\"File was not uploaded!<br><br>\";
}
}
Echo \"<br>\";
}//end for loop
}
//That\'s all folks!
?>
<a href=\"index.php\" target=\"_self\">Back to Upload form!</a>
</font>
</center>
<body>
</html>

 

Kösz eztt kipróbálom már elv tölt fel nekem vmit de nem akar véget érni xd

Nem elérhető Benceee

  • 4785
    • Profil megtekintése
.zip feltöltõ rendszer weboldalba/ra.
« Válasz #5 Dátum: 2012. április 26. - 18:40:27 »
0 Show voters
Akkor próbáld kisebb fájlal.

[PlayZone]Rulexface

  • Vendég
.zip feltöltõ rendszer weboldalba/ra.
« Válasz #6 Dátum: 2012. április 26. - 18:54:31 »
0 Show voters
Idézetet írta: Benceee date=1335458427\" data-ipsquote-contentapp=\"forums\" data-ipsquote-contenttype=\"forums\" data-ipsquote-contentid=\"20655\" data-ipsquote-contentclass=\"forums_Topic
Akkor próbáld kisebb fájlal.
 
Kissebb filet felrakott de még nem teljesen jó kicsit alakítottam de még nem teljesen jó még csinálom...

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal