473,657 Members | 2,535 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cannot upload multiple files

114 New Member
Dear Friends,

I am trying to upload multiple files. But I can't find why it is not working fine. Here is the code.........

numfile.php

[HTML]<form method="POST" action="fileupl oad.php">
<p align="center">
<font face="Verdana" size="2">Number of files</font>
<input type="text" class="text" name="numfiles" size="3" maxlength="3">< br>
<br>
<input type="submit" value="Submit" name="submit" style="font-family: Verdana; font-size: 8pt; font-weight: bold; border: 1px solid #666666; padding: 2"></p>
</form>[/HTML]


fileupload.php

[PHP]
$numoffile = $_POST['numfiles']; //value taking from numfile.php

$file_dir = "files/";

if ($_POST) {
for ($i=0;$i<$numof file;$i++) {
if (trim($_FILES['myfiles']['name'][$i])!="") {
$newfile = $file_dir.$_FIL ES['myfiles']['name'][$i];
move_uploaded_f ile($_FILES['myfiles']['tmp_name'][$i], $newfile);
$j++;
}
}
}
if (isset($j)&&$j> 0) print "<center><f ont family='verdana ' size='2' color='green'>Y our file(s) has been uploaded.</font><br>";
print "<p><h3 style='font-family:verdana; color:green;tex t-align:center'>U pload Files</h3></p><form method='post' enctype='multip art/form-data'>";
for($i=0;$i<$nu moffile;$i++) {

$num = $i+1;
print "<center><s pan style='font-family:verdana; font-size:10pt'>File $num </span> <input type='file' name='myfiles[]' size='30'><br>" ;
}
print "<p align='center'> <input type='submit' name='action' value='Upload'> </p>";
print "</form>"; [/PHP]




Please help me out where is the error.........

Thanks
Deepak
May 7 '07 #1
0 1110

Sign in to post your reply or Sign up for a free account.

Similar topics

6
10557
by: x. zhang | last post by:
Hi Guys, We know that we can use <input type=file ...> to upload one file per time to the server. My question is if there are some way to upload multiple files per time to the server. (Of course, we can use <input type=file ...> multiple times and then submit once. But this is not what I want, because we have to click "browse" button several times to select multiple files before submit in this way.) "Upload multiple files PER TIME", I...
5
1782
by: Jason | last post by:
I have a potential need to upload multiple PDF legal documents. Is it possible to attach more than one file per upload?
7
2751
by: crowl | last post by:
Hi there, I am looking for a component allowing me uploading multiple files by my asp page. I have found several components achieving this by require a <input type="file" name="FileX"> field for each file to upload. I want to allow my visitor to select the files to upload in the "Open" window. In the "Open" window it should be possible to select multiple files. Does such an asp component exist?
7
3181
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" name="file_1" size=46 /><input type=submit /> so, after adding a few files, the input fields look like this:
21
34385
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Uploading files from a local computer to a remote web server has many useful purposes, the most obvious of which is the sharing of files. For example, you upload images to a server to share them with other people over the Internet. Perl comes ready equipped for uploading files via the CGI.pm module, which has long been a core module and allows users...
6
2704
by: Milan Krejci | last post by:
while(list($key,$value) = each($_FILES)) { if(!empty($value)){ $filename = $value; $add = "upimg/$filename"; echo $_FILES; $error=copy($_FILES, $add); if (!$error) $progressUploadingPhotos=false; $error=chmod($add,0777); if (!$error) $progressUploadingPhotos=false;
43
9878
by: bonneylake | last post by:
Hey Everyone, Well this is my first time asking a question on here so please forgive me if i post my question in the wrong section. What i am trying to do is upload multiple files like gmail does. I found a script that does this on easycfm.com (Topic 13543). But anyway when i try to upload multiple files it will create multiple records in my database (like it should), but it wont upload multiple files. What ever file i choose to upload...
4
4876
by: MoroccoIT | last post by:
Greetings - I saw somewhat similar code (pls see link below) that does mupltiple files upload. It works fine, but I wanted to populate the database with the same files that are uploaded to mydirectory, but for some reason, I am getting different file names on the database. Here is the full code: please do serach on kewword "database" to see where I added my database code - that where I need help with. And here the link where I got it...
1
4876
by: chennaibala | last post by:
can any one send me mutiple image upload program and save the file name with extension in mysql table.we must cheak uploaded file type like bmp or any image file while uploading. i develop program,which can upload many file in folder.problem is,am unable to save my file name in to database.because i used same name for all input file type as file. i dont know get name of file.below i presented my coding for ur view.fed up with my coding..pls...
0
8397
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8310
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8827
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8605
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6167
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4158
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4315
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2731
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1957
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.