XUpload - Pass the file upload field name to post vars

Message
Author
John.Ohl
Posts: 2
Joined: Dec 07, 2008 12:59 am

Pass the file upload field name to post vars

#1 Postby John.Ohl » Dec 07, 2008 1:03 am

Using xUpload Pro.

Anyone have any idea how I would go about passing the name of the file input field along with the post vars? For example, I have an uploader with 10 file input boxes, all named file_1, file_2, file_3 all the way through file_10

How would I go about passing the field name into the post vars? For example if I uploaded a file from the file_1 and file_3 input boxes i'd like to see output something like the following

Array
(
[file_name] => Array
(
[0] => 697894121621.jpg
[1] => 162123165414.jpg
)

[file_name_orig] => Array
(
[0] => test1.jpg
[1] => test2.jpg
)

[file_status] => Array
(
[0] => OK
[1] => OK
)

[file_size] => Array
(
[0] => 29623
[1] => 21345123
)

[file_mime] => Array
(
[0] => image/pjpeg
[1] => image/pjpeg
)

[field_name] => Array
(
[0] => file_1
[1] => file_3
)

Basically, I want to have a way to identify which input box each file came from. If anyone has any input on how I can do this I'd greatly appreciate it.

John.Ohl
Posts: 2
Joined: Dec 07, 2008 12:59 am

#2 Postby John.Ohl » Dec 07, 2008 10:44 pm

Nevermind, i figured it out. I had to change line 409 of upload.cgi from

Code: Select all

       my @file_fields = qw(file_name file_name_orig file_status file_size file_descr file_mime);
to

Code: Select all

       my @file_fields = qw(field_name file_name file_name_orig file_status file_size file_descr file_mime);