Discussion:
multiple file upload
(too old to reply)
Mrs. Man
2007-11-20 06:06:24 UTC
Permalink
I am trying to develop a form to where users can upload multiple files. But
where i am getting stuck on, is i want the upload file section to be
dynamically built, meaning that it will first display only one input box to
upload a file, and then right below that it will say upload another and if the
user clicks it, it will show another input box to upload another file and so
on, so a user can upload multiple files.
Daverms
2007-11-20 06:48:42 UTC
Permalink
Hi,

This tutorial can help you,

http://www.devarticles.com/c/a/ColdFusion/Multiple-File-Upload-with-CFFILE/
Mrs. Man
2007-11-20 07:30:59 UTC
Permalink
Thank you for your quick response. For the most part that is exactly what i
wanted but the one piece that i need help on is instead of actually showing 10
input fields, is it possible to show 1 field, and then have a link below, that
if clicked displays another input box and so on. So pretty much a user can
determine how many attachments they want to upload.
Azadi
2007-11-20 07:35:38 UTC
Permalink
that functionality has nothing to do with coldfusion. it is purely
client-side and can easily be achieved with a little bit of javascript
and css.
take a look at jQuery js framework - spend 1 day playing with it and
save yourself months in js scripting time later.

---
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com
PaulH **AdobeCommunityExpert**
2007-11-20 07:46:22 UTC
Permalink
Post by Mrs. Man
Thank you for your quick response. For the most part that is exactly what i
wanted but the one piece that i need help on is instead of actually showing 10
input fields, is it possible to show 1 field, and then have a link below, that
http://www.adobe.com/devnet/coldfusion/articles/multifile_upload.html
Daverms
2007-11-20 08:21:16 UTC
Permalink
Hi,

Try something like this,

(But this is only for building the UI. You need to write the Serverside logic
for this.)


<html>
<head>
<script type="text/javascript">
function insRow()
{
var x=document.getElementById('myTable').insertRow(1)
var y=x.insertCell(0)
y.innerHTML="Specify your file here <input type='file' name='file1'>"
}
</script>
</head>

<body>
<table id="myTable" border="1">
<tr>
<td>Specify your file here <input type='file' name='file1'> </td>
</tr>
</table>
<br />
<input type="button" onclick="insRow()" value="Upload Another">

</body>
</html>
Mrs. Man
2007-11-20 11:44:16 UTC
Permalink
Thank you all for your responses, i appreciate it. Daverms javascript was
exactly what i was looking for.

But i do have one more question, when i submit my form to upload the file and
i try to print the form.file variable it prints out the following:


/opt/coldfusion8/runtime/servers/coldfusion/SERVER-INF/temp/wwwroot-tmp/neotmp18
446.tmp

<cfif IsDefined("Form.file")>
<cfoutput>
#Form.file#
</cfoutput>
<cfelse>
<html>
<head>
</head>
<body>
<cfform action="#CGI.SCRIPT_NAME#" enctype="multipart/form-data" method="post">
<table border="1">
<tr>
<td>Specify your file here <cfinput type="file" name="file"> </td>
</tr>
</table>
<br />
<cfinput type="Submit" name="upload" value="upload">
</cfform>
</body>
</html>
</cfif>

Is there a way to grab the filename that is being uploaded?
Azadi
2007-11-20 11:57:44 UTC
Permalink
to upload a file you use <cffile action="upload" destination="..."
filefield="your form's file filed name here" ...> tag on your form's
action page.

the name of uploaded file will then be available to you as
#cffile.serverfile#

---
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com

Daverms
2007-11-20 11:55:22 UTC
Permalink
Hi,

You can't print it merely using <cfoutput> try the <cfcontent> tag instead.
Continue reading on narkive:
Loading...