php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10728 HTTP_POST_FILES iteration
Submitted: 2001-05-08 07:17 UTC Modified: 2001-05-08 07:22 UTC
From: spud at i-space dot org Assigned:
Status: Not a bug Package: HTTP related
PHP Version: 4.0.4pl1 OS: Linux 7.0
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: spud at i-space dot org
New email:
PHP Version: OS:

 

 [2001-05-08 07:17 UTC] spud at i-space dot org
i have multiple upload (3) form and
when i try something like this :

reset($HTTP_POST_FILES);
for ( $i=0; $i<=2; $i++ ) {
 $temporary = "image".$i;
 $file_name = $HTTP_POST_FILES["$temporary"]['name'];
 $file_type = $HTTP_POST_FILES["$temporary"]['type'];
 $file_size = $HTTP_POST_FILES["$temporary"]['size'];
 $temp_name = $HTTP_POST_FILES["$temporary"]['tmp_name'];
 copy($temp_name, "/var/cult.bg/html/register/images/$dir_name/$file_name");
 $url = $rel_image_url . "/$file_name";
 $query_i = "INSERT INTO images VALUES ('$id','$r_id','$file_name','$file_size','$file_type','$url')";
 mysql_query($query_i);
}

it puts only the first file in the database and gives an error - Duplicate (something).
it works only without the for cycle - with three times handling the uploads.
i'm not sure it's bug (maybe misunderstanding :).
p.s. when i do - INSERT IGNORE INTO ... it puts the first file but doesn't shows the error.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-05-08 07:22 UTC] derick@php.net
I think you have an error in your scripting logic.
You probably get a warning about a duplicate Key, and that is most probably caused by that $id field of yours. Make sure you are not adding more record which have the same primary key.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 11:01:30 2024 UTC