ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> php-db
php-db
Re: [PHP-DB] Upload multiple files?
by other posts by this author
Aug 29 2003 9:55PM messages near this date
[PHP-DB] Upload multiple files? | RE: [PHP-DB] Upload multiple files?
Very simple...

Call you files being uplaoded file1, file2, fileX in the HTML form..

[html]
<form method="post" action="uploadprocess.php" enctype="multipart/form-data"> 
<input type="file" name="file1" size="20"> 
<input type="file" name="file2" size="20"> 
<input type="file" name="file3" size="20"> 
<input type="submit" name="submit" value="submit"> 
</form> 
[/html]

Then process with code like this:

[code]
$STARTFILE = 1;
$ONFILE = "file" . $STARTFILE;

while (isset($HTTP_POST_FILES["$ONFILE"])) {

  // Try!
  $SrcPathFile = $HTTP_POST_FILES["$ONFILE"]["tmp_name"];
  $SrcFileType = $HTTP_POST_FILES["$ONFILE"]["type"];
  $DstFileName = $HTTP_POST_FILES["$ONFILE"]["name"];

  // File Processing
  if (file_exists($SrcPathFile)) {

    // handle it
  }

  $STARTFILE ++;
  $ONFILE = "file" . $STARTFILE;
}
[/code]

You may want to update the $HTTP_POST_FILES ->  $_FILES depending on PHP
version, etc...

Code from: http://php.dreamwerx.net/forums/viewtopic.php?t=6

good luck..



On Fri, 29 Aug 2003, Chris Payne wrote:

>  Hi there everyone,
> 
>  I have created a newsletter system where you can do lots of nice things, one of the things
 is to be able to upload your images for the newsletter via the interface, unfortunately you
 have to do them 1 at a time.  Is it possible to be able to select multiple images in 1 go?
> 
>  The image info is stored in a DB and the images themselves are on the server, this way I c
an do lots of nice things to manage the images that have been uploaded without having to acc
ess the filesystem too much (I love PHP and MySQL, makes it so easy).
> 
>  Thanks everyone.
> 
>  Chris

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Thread:
Chris Payne

Aaron Wolski
Chris Payne
Aaron Wolski

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved