Re: HTTP_Upload
| From: | Cosmin Chiru | Date: | Mon, 24 Jul 2006 16:54:02 +0000 |
| Subject: | Re: HTTP_Upload | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-24746@lists.php.net to get a copy of this message | ||
> Hello!
>
> I'm using HTTP_Upload in order to upload multiple files on some webserver.
> Thing is, I also have to record in a database table the first picture
> uploaded in one session.
>
> Code looks like this:
>
> // snip
> // Upload market pics
> $upload = new HTTP_Upload("en");
> $files = $upload->getFiles();
> $last_id = $_db->last_id();
>
> foreach($files as $file)
> {
> if ($file->isValid())
> {
> $dest_name = $file->moveTo("images/market/");
>
> $real = $file->getProp("real");
>
> $sql = "INSERT INTO bursa_poze SET \n"
> . "user_id = '1', \n"
> . "bursa_id = '$last_id', \n"
> . "poza = '$real'";
>
> if ($_db->query($sql))
> {
> $result = "Datele au fost adaugate.";
> }
> }
>
I was in a rush and forgot to post the question: how can I get the name of
the first file which is being uploaded? I have tried $files[0]["name"] but
it didn't work.