473,750 Members | 2,451 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

script for multiple file upload/attachment in web form

Hi,
I am looking for script to allow multiple files can be
uploaded/attached in webform ( mostly cgi/perl or php).

But I don't like the multiple input boxes using "<input type="file"
size="40" maxlength="40" name="filename[]">" html tag. As it will
limit the no. of files can be uploaded(only as many of this boxes I
write in form & doesn't look good in form also).

I am looking for multiple file upload in web form using "select" or
"textarea" html tags. So I can upload/attach multiple files without
limit, every attached file will be kept in "textarea/list", than
processed on submit button call.

Can any one suggest where this script can be found, I googled..., but
no luck over there.

Thanks,
Avin Patel
Jul 23 '05 #1
1 5524
Avin Patel wrote:
I am looking for multiple file upload in web form using "select" or
"textarea" html tags. So I can upload/attach multiple files without
limit, every attached file will be kept in "textarea/list", than
processed on submit button call.


This isn't going to work. <input type="file" ...> is "special". When the
browser posts the form, it knows to take the contents of the file pointed
to by that form control and send it to the server. The browser has no way
of knowing what to do with a list of files in a <select> or <textarea>.

What you _can_ do, in modern browsers at least, is to let the user "add"
as many <input type="file" ...> inputs as they require:

<script type="text/javascript">
function addFile(b) {
if (b && b.parentNode &&
b.parentNode.in sertBefore &&
document.create Element) {

var fileInput = document.create Element('input' );
fileInput.type = 'file';
fileInput.name = 'filename[]';

b.parentNode.in sertBefore(file Input, b);

b.parentNode.in sertBefore(docu ment.createElem ent('br'), b);
}
}
</script>
<form name="myForm" method="post" enctype="multip art/form-data">
<input type="file" name="filename[]">
<br>
<input type="button" value="Add another file" onclick="addFil e(this);">
</form>

It adds the inputs in IE 6SP1, Firefox 0.10.1 and Opera 7.54. I don't
know if it properly submits the filename controls (because they are all
named the same, and have [] in them). If it doesn't work as is, it would
probably work if you gave each input a unique name:

fileInput.name = 'filename' + (one plus the last filename added);

Obviously that's psuedo-code, obtaining the next filename input name
could involve a global variable, or possibly querying the form to obtain
the value of the last filename input.

--
Grant Wagner <gw*****@agrico reunited.com>
comp.lang.javas cript FAQ - http://jibbering.com/faq

Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3324
by: Web Master | last post by:
Hi, I am having a little issue with Jacks Form mail php script. I have installed it and configured the form to get it to work, but for some bizarre reason I have 2 issues I can't seem to debug. Issue#1: I get 2 copies of the form that gets submitted each time. Issue#2: The header does not display the "FROM" information in Outlook, but I can see the From information in my email spam filter
10
3084
by: Brian Henry | last post by:
Hi, I am having a problem with an attachment system I made... it works with files up to ~3MB in size then after that if you try to upload a file it just goes to a "Page can not be displayed" page like it tried to do it but errored... I thought changeing the max size for the file input box to about 100mb would fix it but nope here is my page code and my code behind code... ===============
4
6262
by: Jonny | last post by:
Hello Group How do I open a Save File Dialog from an ASPX page behind a browse button? Any help would be fantastic!! I am using ASP.NET 1.1 using VB.NET as the coding language TIA
1
1487
by: sohail28 | last post by:
Respected Sir /Madam, I create one web page which includes online reservation using phpscript. Now this page is working fine, but it executes on the same page. i want here, when i click submit button , it shud post this page in next page. Also i want to retrieve some of the text field result to be retreive in hidden text field in next page before it pass the records to email.
7
3190
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:
9
20898
by: 8anos | last post by:
Hello, I am new at the community and newbie at programming :) As you may know rapidshare provides a perl script for linux, to upload files at their servers. You can find the original scripts at rapidshare news : http://images.rapidshare.com/software/rsapi.pl If you test it you will see that you can upload one file at time. I try to modify it in that way that script can read a text file with the names of the files i want to...
5
3289
by: camphor | last post by:
hi, I have found an upload script in hotscripts and have implemented it into the website, I followed the installation steps to 'give write permissions to php on the upload folder (which is _uploadedfiles_xxxx) (php must be allowed to move uploaded files to this folder' - uploadedfiles_xxxx. I typed <?php chmod ('_uploadedfiles_xxxx',640); ?> into notepad and saved it as php in the uploaded_xxxx folder, when I went to test it, the error...
3
5192
by: aRTx | last post by:
I have try a couple of time but does not work for me My files everytime are sortet by NAME. I want to Sort my files by Date-desc. Can anyone help me to do it? The Script <? /* ORIGJINALI
1
47478
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 Many websites have a form or a link you can use to download a file. You click a form button or click on a link and after a moment or two a file download dialog box pops-up in your web browser and prompts you for some instructions, such as “open” or “save“. I’m going to show you how to do that using a perl script. What You Need Any recent...
0
9002
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
8840
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
9399
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9345
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8266
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6817
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
6083
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4717
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...
2
2811
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.