php-general Digest 12 Nov 2009 04:47:24 -0000 Issue 6438

Topics (messages 299773 through 299779):

Re: Multiple file upload
        299773 by: Martin Scotta
        299774 by: Huy Nguyen
        299775 by: tedd
        299776 by: Bastien Koert

Job Opening
        299777 by: Robbert van Andel

advice on setting up new site
        299778 by: PJ

Re: How to create CA certificate with PHP
        299779 by: Manuel Lemos

Administrivia:

To subscribe to the digest, e-mail:
        [email protected]

To unsubscribe from the digest, e-mail:
        [email protected]

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message ---
On Wed, Nov 11, 2009 at 12:09 PM, Matthew Croud <[email protected]>wrote:

> Dear lords of PHP,
>
> I have a working image upload script that meets all my needs,
> My question is I need to upload multiple images using the same form,
>
> This is the PHP part I have so far, largely taken from a book:
> _________________________________________________________
>
> $file_dir = "/public_html/uploads";
> foreach($_FILES as $file_name => $file_array) {
>        echo "path: ".$file_array["tmp_name"]."<br/>\n";
>        echo "name: ".$file_array["name"]."<br/>\n";
>
>        $UploadName = $file_array["name"];
>
>        if (is_uploaded_file($file_array["tmp_name"])) {
>                move_uploaded_file($file_array["tmp_name"],
> "$file_dir/".$file_array["name"]) or die ("Couldn't copy");
>                echo "file was moved!<br/>";
>        }
> }
> _________________________________________________________
>
> Lets say the HTML from that sends data to this script has 3 upload forms
> that get send to $_FILES, would I access the data by modifying the following
> line from the above example:
> ...
> foreach($_FILES[' UPLOADIMAGE1 '] as $file_name => $file_array) {
> ...
>
> ...
> foreach($_FILES[' UPLOADIMAGE2 '] as $file_name => $file_array) {
> ...
>
> ...
> foreach($_FILES[' UPLOADIMAGE3 '] as $file_name => $file_array) {
> ...
>
> Thanks for reading!
> Matt Cheezoid
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Your foreach does exactly what you are asking.

foreach($_FILES as $file_name => $file_array)

The keys in $_FILES are the <input type="file" /> in your form.
If you have 3 files... then count( $_FILES ) should be 3


-- 
Martin Scotta

--- End Message ---
--- Begin Message ---
Do you mean 3 forms, each having a file upload input?  Or 1 form with 3 file 
upload inputs?

If you have 3 forms, then the user can only submit one form at a time.  So your 
$_FILES would contain only one file.

If you have one form with 3 file upload, it depends on if they are the same 
name for the file input - whether they all are "UPLOADIMAGE[]", or each one is 
"UPLOADIMAGE1", "UPLOADIMAGE2", "UPLOADIMAGE3", etc.




-----Original Message-----
From: Matthew Croud [mailto:[email protected]] 
Sent: Wednesday, November 11, 2009 9:10 AM
To: PHP General list
Subject: Multiple file upload

Dear lords of PHP,

I have a working image upload script that meets all my needs,
My question is I need to upload multiple images using the same form,

This is the PHP part I have so far, largely taken from a book:
_________________________________________________________

$file_dir = "/public_html/uploads";
foreach($_FILES as $file_name => $file_array) {
        echo "path: ".$file_array["tmp_name"]."<br/>\n";
        echo "name: ".$file_array["name"]."<br/>\n";
        
        $UploadName = $file_array["name"];

        if (is_uploaded_file($file_array["tmp_name"])) {
                move_uploaded_file($file_array["tmp_name"], "$file_dir/". 
$file_array["name"]) or die ("Couldn't copy");
                echo "file was moved!<br/>";
        }
}
_________________________________________________________

Lets say the HTML from that sends data to this script has 3 upload  
forms that get send to $_FILES, would I access the data by modifying  
the following line from the above example:
...
foreach($_FILES[' UPLOADIMAGE1 '] as $file_name => $file_array) {
...

...
foreach($_FILES[' UPLOADIMAGE2 '] as $file_name => $file_array) {
...

...
foreach($_FILES[' UPLOADIMAGE3 '] as $file_name => $file_array) {
...

Thanks for reading!
Matt Cheezoid

--- End Message ---
--- Begin Message ---
Hi:

This is one way to do it:

http://php1.net/c/multi-uploads/index.php

You can either give the user defined "slots" for them to fill, or not, or give them a button to add another "Choose File" button.

After you get the user information, then you can go through upload, scrub, and approve the data before doing anything with it.

Cheers,

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
On Wed, Nov 11, 2009 at 12:08 PM, tedd <[email protected]> wrote:
> Hi:
>
> This is one way to do it:
>
> http://php1.net/c/multi-uploads/index.php
>
> You can either give the user defined "slots" for them to fill, or not, or
> give them a button to add another "Choose File" button.
>
> After you get the user information, then you can go through upload, scrub,
> and approve the data before doing anything with it.
>
> Cheers,
>
> tedd
>
> --
> -------
> http://sperling.com  http://ancientstones.com  http://earthstones.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

http://articles.sitepoint.com/article/php-gallery-system-minutes

-- 

Bastien

Cat, the other other white meat

--- End Message ---
--- Begin Message ---
I hope this is not violating any terms of usage rules. I thought I'd let you
know that Salem Hospital in Salem Oregon is hiring a web developer.  the
position is part time and temporary with the potential to become permanent
and full time. They have a huge intranet and a smaller public site using
PHP.  They're interested in someone that knows PHP, JavaScript and a working
knowledge of ASP.net

Details can be found here:
http://salemhospital.hodesiq.com/job_detail.asp?JobID=1713080&user_id=

--- End Message ---
--- Begin Message ---
Hi guys,
I've already posted on FreeBSD and didn't want to ignore you, so here goes:
I appreciate the help you have given me in the past and present... I am
not competent to handle the project we are embarking on, so let me ask
(offer ?) it here:
We're about to start new enterprise in the food service sector (I hate
the terms industry for anything related to food) which is a totally new
concept - can't reveal at the moment. And we are going to need someone
to implement the site.
So here's what I need to find out:
1. We're looking for someone who would be interested in working on it
and could handle all aspects on FreeBSD (I want to avoid MS and
especially anything not open source - requires programming of whatever
works best -- important: database (probably mysql - seems to be most
popular and our host uses it); will need flash or lots of images &
eventually instructional videos (flash ? or ?)
will need gps tracking of equipment (vehicles); inventory tracking on
daily/weekly basis; invoicing; AR/AP and CC management.
There's no reason why the work can't be done over the Internet... I've
done this before...
Let me know if you're interested and we can discuss methods of working
and payment... etc.
2. I would appreciate some suggestions about Unix programs that could be
applicable to meet our needs.
I look forward to hearing from from you :-)
Questions are welcome ... so are investors ;-)
PJ



--- End Message ---
--- Begin Message ---
Hello,

on 11/10/2009 08:28 PM Tanveer Chowdhury said the following:
> Hello all,
> 
> Using openssl, I can create CA certificate by using the linux command line.
> 
> But this thing I want to do using PHP that is I want to add some information
> in the openldap regarding a user and also would like to insert his public
> key certificate along with the other information.
> 
> Can you please suggest any link or documentation on this topic. For your
> information I can insert information like user,email,phone,email in openldap
> but haven't tried to insert the certificate in openldap yet. The issue is, I
> want to make the whole process automated like all user information user will
> input in a form and upon clicking submit button all those information along
> with his certificate which will be generated then and there will be inserted
> in openldap.

You may want to try this PHP class exactly for that purpose:

http://www.phpclasses.local/crypt_openssl

-- 

Regards,
Manuel Lemos

Find and post PHP jobs
http://www.phpclasses.org/jobs/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

--- End Message ---

Reply via email to