Jul 20, 2008

upload files

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > PHP Programming

free web hosting

upload files

LuciferStar
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>

 

 

 


Reply

LuciferStar
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++;
}
?>

 

 

 


Reply

Roly
Are you just showing us your code or do you have an error with it and need help?

Reply

Spectre
*Spam removed.

Stop spamming in the forums.

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

Reply

LuciferStar
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.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : upload files

  1. Image Upload - ?!? (11)
  2. Upload Pics With Php? - (6)
    Can anyone help me out again? Thanks. I need a code that has a basic form that allows you to
    browse for an image file and when the submit button is clicked, that image gets uploaded to a folder
    in my site (e.g. images/*.jpg)...
  3. Getting List Of Directories And Files Using Php - PHP Function for Directory and File List (6)
    is there a php function that lists the content of some folder.... example: /New folder new.txt
    left.gif download.zip dc.exe ....so is there..? /rolleyes.gif' border='0'
    style='vertical-align:middle' alt='rolleyes.gif' /> ...
  4. Need Some Help In File Browser - listing all sub folders and files in them. (8)
    Hey I want to create a very simple file browser, so that, it reads all the sub-folders which are
    places in a directory, and the files inside the sub-folders (It reads only files inside sub-folders
    and list them in simply. ) Also, it creates a directory (any name) inside each sub folder. My
    Following code reads on the files inside the main directory, it does not read the files inside the
    sub-folders.. I appreciate any help. CODE <? $path = "./"; $dir_handle =
    @opendir($path) or die("Unable to open $path"); whil...
  5. Download Script For Mp3 Files - (0)
    Hello, I'm looking for a download script for sound files (e.g. mp3, avi, wma, and other ones).
    i have found a few download scripts but they would not work for sound files for some reason. also
    this will not be used for allowing downloading of illegal or riped music, what i will be using this
    script for is i'm making a site for my church and the pastor wants to be able to recored the
    services and then have me upload them to the site so that the church members can download them for
    what ever reason. If some one could tell me how to make one or could show me a plac...
  6. Php Ftp Upload Form - Adding User Directory to PHP Upload Form - Help (0)
    Alright I am trying to have a PHP FTP Upload Form that allows the user to create the directory
    folder for where they want to upload there files to. example: Main Directory: vainsoft.com There
    directory: vainsoft.com/modeling or vainsoft.com/photography But I dont want them to be able to
    upload things into the main directory, only sub-directories, is that possible with this coding that
    I have: //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($fi...
  7. Change Permission With Php Code - code to change files' and folders' permissions? (3)
    As everyone know, there two ways (that I can think of) to change files' and directories'
    permissions. One is to change it in your cPanel's Disk Manager and the other is with an FTP
    client that supports chmod. Well, I'm doing something for my site that requires files to have
    full permissions (Execute, Write, and Read on all three groups). At first, I thought that if I made
    the directory 777, then every file created in that directory will be 777 as well. I'm wrong. An
    alternative to doing this is to change each file permission myself, but that would be...
  8. Batch Upload Script - In need of batch upload script (1)
    I'm in the process of making a photo gallery script. I need ideas on how to make a batch upload
    script. I want the user to be able to upload files to a folder via FTP and then go to the admin
    section of the gallery and add the previously uploaded photos to the MySQL database. I guess what I
    need it to do is find all the files in a specific folder and see if they are already in the
    database, if they aren't in the database - add them. Any help would be appreciated. I figured
    trap17 would be a good place to get help with this /wink.gif" style="vertical-align:middle...
  9. Grabt Access To My Protected Files - grabt access to my protected files (2)
    Hi all, I am sure all of you are great programers but First i am no code programmer i am just
    trying to learn to run my sites, will the problem is i got a code from the web to protect my files
    ,1st i want to know how to work it out then i will try other things but can't let it go without
    a fight thanx all php: CODE <?php if ( ! defined( 'myname' )
    ) {         print "You cannot access this file directly.";         exit(); }
    customer data here ?> now i can't access my files what is the meth...
  10. File Upload - File upload (1)
    I need to add a facility on my customer's website so his clients can send him jobs, typically
    5mb - 50mb. I've looked around the web and researched this, and tried a few tests (failed), but
    my brain's beginning to hurt. Could someone please tell me the best way to go about this,
    please. The site is done in Flash, but I'm sure a link to an html page would be ok if necessary....
  11. Security Issue Writing Files - Security issue writing files (1)
    Hi, first, sorry about my english. i am a beginner with php and i have some question about writing
    files using php in a shared hosting. is a risk?, use database to store data is a better way? i just
    want make an interface (in php) that write the data in a .html extension file to show to everybody
    the html page and just the php interface is to the content manager. thanks in advance ...
  12. [php]simple Flat File Text Manipulator - Example on how to use forms to write to files in PHP (3)
    I made a simple flat file text editor, that can show you probably how simple it is to use forms with
    php and write that data to file. This example has 2 files, submit.php, and postit.html. Submit.php
    is used to write title, and some text, and add html tags, and paragraph tags where new paragraphs
    are. Here's the file with comments. I think that HTML really doesn't need some more
    explaining. CODE Title: <br /> <input type="text"
    name="title" size="53"> <br /> Text: <br />
    <textarea nam...
  13. Forms, Text Files, And Php For A Signature Generator. - Help a little. (1)
    Hello everyone! I am in need of some code a for a signature generator I am making. I am using
    BuffaloHELP's code for the php file, now I am trying to improve that code by making a form in a
    html file that will have the user say what is on the sig! But now, I need help getting the form
    data that is posted by the user to get into that sig! There is a file, sig.txt, where that tells
    the php file what text will go on the sig. But how can I make the form data in the html file go into
    the text file so it will go onto the sig? You might want to read BuffaloHELP&...
  14. Reading Files From Directory To Array, And Using $_get To Get Them - Simple way to manage lot's of files (2)
    Some user posted a similar problem i had when i tried to figure out how to update content on my
    website in less work as possible. This is just part of the "big" plan i have for my site but it can
    be helpfull to you guys if you like FlatFile. I hope that mod's don't mind me posting the
    same code here and on their forums, couse if they do i'll delete it from their forums
    /biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /> So
    here's the situation. Let's say you have a folder called 'myfilesdirectory' on your
    s...
  15. Writing To Files And Such - (3)
    Ok lets say i have a config.php file, i want to edit something without open it, i know every line
    number and that, now how would i do this? I will show you a example: CODE <?php
    $CONFIG['user']            =    'root';
    $CONFIG['server']        =    'localhost';
    $CONFIG['pass']            =    '******';
    $CONFIG['db']            =    '******';
    $CONFIG['install']        =    '1';
    $CONFIG['lang']       ...
  16. Files Required? - (5)
    I want to learn php and I am already on the first steps to doing it. I have set up my server using
    easyPHP as well as XAMPP which is a package containing FileZilla, Apache and MySQL. Other than
    easyPHP, XAMPP and MySQL, what other softwares are required to be set up for me to successfully
    learn how to program with PHP?...
  17. How To Sort Files Of A Directory using Php - (11)
    The following code displays the files of folder...but they are displaced by the order of adding... i
    want to sord the files / folders alphabetically and sord by accending order and by decending
    order.. can some one help me. $path = ""; $dir_handle = @opendir($path) or
    die("Unable to open $path"); echo "Directory Listing of $path "; while($file =
    readdir($dir_handle)) { if(is_dir($file)) { continue; } else
    if($file != '.' && $file != '..') { echo " $fi...
  18. Displaying Files Of A Directory - (2)
    I want to display the contents of a directory.. i have the following code.. It gives the output in
    one column only... like file1 file2 file3 file4 . . . . . Since there are lot of files so this
    column gets very long..i want to display the x number of files in each column.. like if there are 22
    files.. then file 1 file 11 file 21 file 2 . file 22 file 3 .. . . . file 10
    file 20 This was just an example..I know it can be done by using but i dont know how to do it
    with loop. Please help me. QUOTE $dir = './'; $handle =...
  19. Wappyftp V1.00 - upload to server via ftp from your mobile phone :-) (8)
    wappyFTP v1.00 by wappy --- site: http://cult.trap17.com mail: admin@cult.trap17.com --- -Welcome
    to wappyFTP, with this wap script your users can upload files directly to their server via FTP from
    a mobile phone! --- -Its extremley easy to install, open index.php and put the name of your site
    instead of YOURSITE.COM -Upload the folder wappyFTP_v1.00 to the root directory of your web server
    -Link to it like wappyFTP_v1.00/index.php -Its all done ENJOY --- YOU MAY DISTRIBUTE AND/OR EDIT
    THIS SCRIPT BUT DO NOT REMOVE THE AUTHORS NAME! --- ©2006-2007 wappyCULT /...
  20. Logging Dowload Files From Your Server Onto A Html File - (1)
    Well, i had the idea of logging the downloads from my web in a html file few weeks ago, and i solved
    it with a lil php page included in my homepage. You could name the links with a name like
    "download.php?file=filename.ext" and then, in the download.php put the next code: (well you put
    the html and head and body tags if u want, i only write the php here) CODE <? if
    (isset($_GET['file']))
    $file=$_GET['file']; //so it gets the GET data from url
    (file=filename.ext); $ip=$_SERVER[...
  21. How To List Files In A Directory + Subdirectory And Then Use Them. - (8)
    So lets say i have folders called friends and work in a folder called pics. how would i make a
    function that lists the files in those folderscalled images kinda like this: CODE
    $directory = "./" function listfiles($directory) { //here should go the
    script to list the files in those directories. so that i can continue to work with them. like for
    example if there were images it would list all  the images and i could write a script to make a
    thumb of them and then save it into a thumb folder(not asking for all of that). but how w...
  22. Directory Files Displaying - (5)
    I have many files in a directory..I want to create a page , like A B C D E F ..... when some one
    click on A , it should display all the files starting from letter A , and when clicks on B , it
    should show all the files in that directory starting from B , and so on... I have no idea how to
    display the files of the directory iin that way. Kindly assist me.....
  23. Displaying Latest Added Files Of Subdirectories ? - (5)
    For example,i have a directory , which has 3 sub directories a,b and c...and i have some files in
    all subdirectories.. is it possible that i can display the latest added files to any of sub
    directory a,b, or c.?i think i will have to use sort by date function but how it should be done that
    it compares the files of all the subdirectories directories ?...
  24. What Kind Of Files Are .lib - (2)
    I want to know , if we use some pre-made php script , there are often many files with other
    extension..i have been watching many times some files names ".lib" . what kind of files these are
    ... there's written C/C++ inline file.. why these kinds of files are needed in php scripts.. and
    are there some replacements for it ? (So that we can do things without it ?)... for example im
    pasting the coding of a file.. ban.lib ..i want to ask, why it is .lib file..why it cant be .php....
    CODE <? function file2str($p){if($p=="") retur...
  25. Here's A Nice And Interesting Way To Make Comments - In your php files (9)
    We all know that when we make websites, sometimes, we just don't want a code to be there... for
    now. What I'm saying is, for example: Your name is Bob. Yes it's Bob. Bob made a website
    and added lots of content. He gets a lot of traffic. He signs up for Google Adsense! Yay! He
    is happy. He makes thousands of dollars a month. He is famous. And that is the exact reason why
    your enemy, Angela, is trying to make your google adsense account bad. Guess what? Angela is your
    sister. Yes she is your sister. What does that mean? She uses the same IP address...
  26. I Need Help With Wordpress/php - I am lost with these files! (7)
    Okay, here is the story. I set up wordpress on my site. I know nothing about PHP and need help. I
    need to know where the url and title info is stored. I checked in the header PHP file, and all I
    saw was: CODE <title><?php bloginfo('name'); wp_title();
    ?></title> And <div id="header"> <h1><a
    href="<?php bloginfo('url'); ?>"><?php
    bloginfo('name'); ?></a></h1> </div> <!--
    /header --> Whe...
  27. Help With Removing Files And Folders - removing all files from a directory (4)
    Is there a function or a group of functions which I can use to delete all the files an folders in a
    directory? I've tried rmdir() but it complains that it can't remove it because there are
    files/folders in it. ...
  28. Image Upload And File Size - (2)
    Hi, I'm trying to upload rather large jpgs files (2560x1920 and ~ 2 megs in size) to my server
    via PHP. The problem I am having is that when I upload and attempt to resize by creating a new
    image, the new image is always black. Code I'm using is: PHP Code: CODE if(
    !empty($thefile_name) ) {                                                  
                                                 $query = "INSERT INTO coldwell_images
    (imagename) VALUES ('insertimage')";                    $result ...
  29. Help With Reading Files - Read and replace/insert data from form (5)
    Hi, Does anyone know how i can do this, or scripts that will work on Trap17's servers and will
    do the following: I have a .doc file form. Which i want to have filled in automactically, by HTML
    Form and emailed to my address, with the data filled in. Any ideas? I have heard many differing
    things, like XML, RTF, DOC, PDF... I have serched through many places and come up empty handed with
    anything that works. /sad.gif' border='0' style='vertical-align:middle' alt='sad.gif' /> ...
  30. Help With Uploading Files! - (4)
    Here is the code i am going to use, written originaly for only 2 files, image and location, I added
    'thumbnail', can someone check through it please? CODE $submit =
    $_POST['submit']; $name = $_POST['name'];
    $description = $_POST['description']; $age =
    $_POST['age']; $subcat = $_POST['subcat']; $with
    = $_POST['with']; $added = $_POST['added'];
    $type = $_POST['type...



Looking for upload, files

Searching Video's for upload, files
Image Upload
?!?
Upload Pics
With Php?
Getting List
Of
Directories
And Files
Using Php
PHP Function
for
Directory
and File
List
Need Some
Help In File
Browser
listing all
sub folders
and files in
them.
Download
Script For
Mp3 Files
Php Ftp
Upload Form
Adding User
Directory to
PHP Upload
Form - Help
Change
Permission
With Php
Code code to
change
files'
and
folders'
permissions?
Batch Upload
Script In
need of
batch upload
script
Grabt Access
To My
Protected
Files grabt
access to my
protected
files
File Upload
File upload
Security
Issue
Writing
Files
Security
issue
writing
files
[php]simple
Flat File
Text
Manipulator
Example on
how to use
forms to
write to
files in PHP
Forms, Text
Files, And
Php For A
Signature
Generator.
Help a
little.
Reading
Files From
Directory To
Array, And
Using
$_get
To Get Them
Simple way
to manage
lot's of
files
Writing To
Files And
Such
Files
Required?
How To Sort
Files Of A
Directory
using Php
Displaying
Files Of A
Directory
Wappyftp
V1.00 upload
to server
via ftp from
your mobile
phone :-)
Logging
Dowload
Files From
Your Server
Onto A Html
File
How To List
Files In A
Directory +
Subdirectory
And Then Use
Them.
Directory
Files
Displaying
Displaying
Latest Added
Files Of
Subdirectori
es ?
What Kind Of
Files Are
.lib
Here's A
Nice And
Interesting
Way To Make
Comments In
your php
files
I Need Help
With
Wordpress/ph
p I am lost
with these
files!
Help With
Removing
Files And
Folders
removing all
files from a
directory
Image Upload
And File
Size
Help With
Reading
Files Read
and
replace/inse
rt data from
form
Help With
Uploading
Files!
advertisement



upload files



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE