Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> upload files
LuciferStar
post Aug 9 2004, 10:59 AM
Post #1


Advanced Member
*******

Group: Members
Posts: 114
Joined: 9-August 04
From: Suzhou Jiangsu China
Member No.: 743



upload.php

CODE
<?php
/**********************************
*
**      file directory list
*
**********************************/
function listthem($add)
{
  $t=$add;
  if ($handle = opendir($add))
  {
     while (($file = readdir($handle))!=FALSE)
     {
         $add.="/".$file;

         if (is_dir($add)==TRUE)
         {
             if($file!="." && $file!=".." && is_dir($add)==TRUE)
             {
                 echo "    <option value=\"".$add."\">".$add."</option>";
                 listthem($add);
             }
         }
         $add=$t;
     }
     closedir($handle);
  }
}
function getdir($add)
{
?>
 <input type="hidden" name="MAX_FILE_SIZE" value="200000">
upload limitations! less than 200KB。<p>
WHERE TO UPLOAD <select size="1" name="DIR">
        <option value="">.</option>
<?php listthem($add);?>
</select>
<?php
}

if($_POST['NAME']=="LuciferStar")//change your name for secu
{           //password is not required in this edition
 setcookie("TestCookies",md5($_POST['NAME']),time()+3600);

 $i=0;
 echo "  <form enctype=multipart/form-data action=savefile.php?NUMBER=".$_POST['NUMBER']." method=post>";
 ?>
 <?php $add="."; getdir($add);?>
 <?php
 while($i<$_POST['NUMBER'])
 {
   $file=sprintf("userfile%d",$i);
   $i++;
   echo "<p>File $i <input name=$file type=file> ";
 }
 echo "<input type=submit value=upload>";
}
else
{
?>
<form action="upload.php" method="post">
<p>USER <input name="NAME" type="text"></p>
<p>PASS &nbsp; <input name="PASS" type="password"></p>
<p>NUMBER <input name="NUMBER" type="text"></p>
<input type=submit>
</form>
<?php
}
?>
</p>  
</form>
Go to the top of the page
 
+Quote Post
LuciferStar
post Aug 9 2004, 11:01 AM
Post #2


Advanced Member
*******

Group: Members
Posts: 114
Joined: 9-August 04
From: Suzhou Jiangsu China
Member No.: 743



savefile.php
CODE
<?php
function upload($form)
{
  $filename=$_FILES[$form]['name'];
  if($filename!=NULL)
  {
     $l=strlen($filename);
     $rest = substr($filename,$l-3 ,$l );

        if($_POST['DIR']!=NULL)  $filename=sprintf("%s/%s",$_POST['DIR'],$filename);
        else $filename=sprintf("%s",$filename);

     if (is_uploaded_file($_FILES[$form]['tmp_name']))
     {
        if(move_uploaded_file($_FILES[$form]['tmp_name'], $filename))
        {//echo $_FILES[$form]['tmp_name'];
           echo "<p>uploaded file: ".$_FILES[$form]['name']." done.";
           echo "<p>link:<a href=\"".$filename."\"></a>";
        }
     }
     else
     {
        echo "Possible file upload attack. Filename: " . $_FILES[$form]['name'];
     }
  }
}
$i=0;
while($i<$_REQUEST['NUMBER'])
{
$file=sprintf("userfile%d",$i);
upload($file);
$i++;
}
?>
Go to the top of the page
 
+Quote Post
Roly
post Aug 18 2004, 04:19 AM
Post #3


Advanced Member
*******

Group: Members
Posts: 144
Joined: 24-July 04
From: Arizona
Member No.: 189



Are you just showing us your code or do you have an error with it and need help?
Go to the top of the page
 
+Quote Post
Spectre
post Aug 18 2004, 05:22 AM
Post #4


Privileged Member
*********

Group: Members
Posts: 873
Joined: 30-July 04
Member No.: 246



*Spam removed.

Stop spamming in the forums.

LuciferStar, please include a description of your scripts, and whether or not you wrote them.
Go to the top of the page
 
+Quote Post
LuciferStar
post Aug 19 2004, 01:39 AM
Post #5


Advanced Member
*******

Group: Members
Posts: 114
Joined: 9-August 04
From: Suzhou Jiangsu China
Member No.: 743



QUOTE(Sauron @ Aug 18 2004, 05:22 AM)
*Spam removed.

Stop spamming in the forums.

LuciferStar, please include a description of your scripts, and whether or not you wrote them.

I got it.

This code is shared.
I just paste this code for share.

some websites did not support ftp,and their webftps are not good enough,every upload time,can only upload 5 / 10 files.

But my code can upload as many as you like.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Getting List Of Directories And Files Using Php(6)
  2. Change Permission With Php Code(3)
  3. Upload Pics With Php?(6)
  4. Image Upload And File Size(2)
  5. Help With Removing Files And Folders(4)
  6. I Need Help With Wordpress/php(7)
  7. Here's A Nice And Interesting Way To Make Comments(9)
  8. What Kind Of Files Are .lib(2)
  9. How To Sort Files Of A Directory using Php(11)
  10. Displaying Latest Added Files Of Subdirectories ?(5)
  11. Directory Files Displaying(5)
  12. How To List Files In A Directory + Subdirectory And Then Use Them.(8)
  13. Logging Dowload Files From Your Server Onto A Html File(1)
  14. Wappyftp V1.00(8)
  15. Displaying Files Of A Directory(2)
  1. Files Required?(5)
  2. Writing To Files And Such(3)
  3. Forms, Text Files, And Php For A Signature Generator.(1)
  4. Reading Files From Directory To Array, And Using $_get To Get Them(2)
  5. [php]simple Flat File Text Manipulator(3)
  6. Batch Upload Script(1)
  7. Security Issue Writing Files(1)
  8. Grabt Access To My Protected Files(2)
  9. File Upload(1)
  10. Php Ftp Upload Form(1)
  11. Download Script For Mp3 Files(0)
  12. Need Some Help In File Browser(8)
  13. Image Upload(11)


 



- Lo-Fi Version Time is now: 11th October 2008 - 11:55 AM