473,473 Members | 1,844 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

file upload problem

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
4 6817
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
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
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

"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: matt | last post by:
I have compiled some code, some written by me, some compiled from various sources online, and basically i've got a very simple flat file photo gallery. An upload form, to upload the photos and give...
3
by: Bijoy Naick | last post by:
I've written a simple file upload user control in VB .NET. It comprises of an InputFile HTML Server Control, an Upload button and a message label. User clicks on the Browse button of the...
6
by: tshad | last post by:
I have an upload file input as: <input id="MyFile" style="width:300px" type="File" runat="Server"> This works fine, but I find that if my page doesn't pass validation during postback, the page...
18
by: Jen | last post by:
I'm using Microsoft's own VB.NET FTP Example: http://support.microsoft.com/default.aspx?scid=kb;en-us;832679 I can get the program to create directories, change directories, etc., but I can't...
4
by: Matt Jensen | last post by:
Howdy I've got a rather strange issue occuring. I used forms based .NET authentication, although I'm also setting some session variables when people login. However, I've found when people use...
5
by: William LaMartin | last post by:
I have a VB ASP.Net application where the user can upload a file using the FileUpload server control. I also want a thumbnail to be created for this file. Unfortunately I can see no means to...
4
by: riteshjain82 | last post by:
Hi, Please go through this: I am having a file (default.asp) on which i am taking many details from a user before mailing it to someone. I have also provided the user with a facility of...
6
by: Vic Spainhower | last post by:
Hello, I am trying to do a FTP file upload which works fine on my localhost but on my ISP server it fails. I can't seem to find where I can go to find the specific cause of the failure. In both...
7
by: pbd22 | last post by:
hi. i am having probs understanding how to grab a file being uploaded from a remote client. i am using hidden input fields for upload such as: <input id="my_file_element" type="file"...
1
by: pbd22 | last post by:
hi. i have been posting this here and elsewhere a lot and can't seem to get resolution on this problem. i have been trying to upload files using a hidden iframe to a asp.net/vb.net form. the...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.