By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,748 Members | 1,427 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,748 IT Pros & Developers. It's quick & easy.

file upload problem

P: n/a
Hello. I have a form with two input file fields for uploading file:

<form name="mynews" action="news.php?action=update&add=<?php print
$id;?>" method="post" enctype="multipart/form-data">

<input type="file" name="file1" size="20">
<input type="file" name="file2" size="20">

When I post I do:
print_r($_FILES);

this is the output:
Array ( [file] => Array ( [name] => [type] => [tmp_name] => [error] => 4
[size] => 0 ) [file1] => Array ( [name] => PlhroforikhMetaptuxiako.pdf
[type] => application/pdf [tmp_name] => /tmp/phpIIYUYT [error] => 0
[size] => 48755 ) [file2] => Array ( [name] => [type] => [tmp_name] =>
[error] => 4 [size] => 0 ) )

The seconf file is never uploaded no matter what I tried.
Upload_file_size is 8MB which is ok for both files.

what else can I check?
Feb 17 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
In article <dt**********@volcano1.grnet.gr>,
G0ng <hk******@softnet.tuc.gr> wrote:
Hello. I have a form with two input file fields for uploading file:

<form name="mynews" action="news.php?action=update&add=<?php print
$id;?>" method="post" enctype="multipart/form-data">

<input type="file" name="file1" size="20">
<input type="file" name="file2" size="20">

When I post I do:
print_r($_FILES);

this is the output:
Array ( [file] => Array ( [name] => [type] => [tmp_name] => [error] => 4
[size] => 0 ) [file1] => Array ( [name] => PlhroforikhMetaptuxiako.pdf
[type] => application/pdf [tmp_name] => /tmp/phpIIYUYT [error] => 0
[size] => 48755 ) [file2] => Array ( [name] => [type] => [tmp_name] =>
[error] => 4 [size] => 0 ) )

The seconf file is never uploaded no matter what I tried.
Upload_file_size is 8MB which is ok for both files.

what else can I check?

Make two forms, with one upload per form and a javascript, that sends
both forms at once.

IMHO per form only one file can be uploaded (?).
Feb 17 '06 #2

P: n/a
What does the rest of the form look like? print_r is showing file,
file1, file2. Is there a form field you're not showing in your code
above?

Read this section of the Php manual and be sure to look at Related
configuration notes. Other php.ini settings besides upload_max_filesize
can effect post
uploadshttp://de.php.net/manual/en/features.file-upload.php#features.file-upload.post-method
v

Feb 17 '06 #3

P: n/a
Jeremy Deuel wrote:
In article <dt**********@volcano1.grnet.gr>,
G0ng <hk******@softnet.tuc.gr> wrote:

Hello. I have a form with two input file fields for uploading file:

<form name="mynews" action="news.php?action=update&add=<?php print
$id;?>" method="post" enctype="multipart/form-data">

<input type="file" name="file1" size="20">
<input type="file" name="file2" size="20">

When I post I do:
print_r($_FILES);

this is the output:
Array ( [file] => Array ( [name] => [type] => [tmp_name] => [error] => 4
[size] => 0 ) [file1] => Array ( [name] => PlhroforikhMetaptuxiako.pdf
[type] => application/pdf [tmp_name] => /tmp/phpIIYUYT [error] => 0
[size] => 48755 ) [file2] => Array ( [name] => [type] => [tmp_name] =>
[error] => 4 [size] => 0 ) )

The seconf file is never uploaded no matter what I tried.
Upload_file_size is 8MB which is ok for both files.

what else can I check?


Make two forms, with one upload per form and a javascript, that sends
both forms at once.

IMHO per form only one file can be uploaded (?).


How this can be done? Two forms with one submit? and how do I get the
data? on only one POST?
Feb 20 '06 #4

P: n/a

"G0ng" <hk******@softnet.tuc.gr> wrote in message
news:dt**********@volcano1.grnet.gr...
Jeremy Deuel wrote:
In article <dt**********@volcano1.grnet.gr>,
G0ng <hk******@softnet.tuc.gr> wrote:

Hello. I have a form with two input file fields for uploading file:

<form name="mynews" action="news.php?action=update&add=<?php print
$id;?>" method="post" enctype="multipart/form-data">

<input type="file" name="file1" size="20">
<input type="file" name="file2" size="20">

When I post I do:
print_r($_FILES);

this is the output:
Array ( [file] => Array ( [name] => [type] => [tmp_name] => [error] => 4
[size] => 0 ) [file1] => Array ( [name] => PlhroforikhMetaptuxiako.pdf
[type] => application/pdf [tmp_name] => /tmp/phpIIYUYT [error] => 0
[size] => 48755 ) [file2] => Array ( [name] => [type] => [tmp_name] =>
[error] => 4 [size] => 0 ) )

The seconf file is never uploaded no matter what I tried.
Upload_file_size is 8MB which is ok for both files.

what else can I check?


Make two forms, with one upload per form and a javascript, that sends
both forms at once.

IMHO per form only one file can be uploaded (?).


How this can be done? Two forms with one submit? and how do I get the
data? on only one POST?


1. you can't submit more than 1 form at once, even with javascript.
2. you can have as many file fields as you want, if you name them
name="file[]"
if you have the extended chm manual search in the notes for "file upload" or
can search online, http://us2.php.net/manual/en/features.file-upload.php in
the notes. you will see a number of code examples of how to handle
multi-file uploads.
Look
Apr 19 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.