[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How to upload local file?

Posted on 2002-03-12
19
Medium Priority
?
203 Views
Last Modified: 2010-04-09
Hi, there,

I need to implement following feature to my HTML:

*********************************************
text field 1           browser button 1
text field 2           browser button 2
.....

submit button
*********************************************

I need to click on each "browser button" and choose a local file name from a popup window, and put this file name into corresponding "text field".  When I click the "submit button", all local file in those text fields will be uploaded.

Can anybody tell me how to do that?

Daisy
0
Comment
Question by:DaisyWang
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 4
  • 3
  • +3
19 Comments
 
LVL 18

Accepted Solution

by:
bruno earned 200 total points
ID: 6858005
you need a component on your server to allow it...

like: http://www.softartisans.com/softartisans/saf.html

then on your page you do...


<input type="file" name="file1">



BRUNO
0
 
LVL 12

Expert Comment

by:lexxwern
ID: 6859372
give BRUNO the points before i copy and paste what he's written!
0
 
LVL 18

Expert Comment

by:bruno
ID: 6859514
lol...i lucked out and managed to be the first one here.  :-)
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:DaisyWang
ID: 6860963
maybe you are same guy, haha :)
0
 
LVL 12

Expert Comment

by:lexxwern
ID: 6870726
no im lexxwern
bruno is not lexxwern
also
lexxwern is not bruno

hope this helps, now DaisyWang you owe me points.

lhn
0
 
LVL 18

Expert Comment

by:bruno
ID: 6871329
Daisy,

did what I posted help you at all?

Somewhat rude to come back and not comment on the problem at hand....


BRUNO
0
 
LVL 12

Expert Comment

by:lexxwern
ID: 6875929
BRUNO its hurts even more when someelse is living in a more favourable timezone.
+0530 INDIA is really a bad one. i get no new quetions whether i log on in the evening or morning :-(

i guess you ppl have taken full adv. of reading the brief history of time, huh!?

Anyway,

lexxwern
0
 
LVL 18

Expert Comment

by:bruno
ID: 6875950
lexxwern,

i have no idea what your comment has to do with the issue at hand.


BRUNO
0
 

Author Comment

by:DaisyWang
ID: 6877024
bruno,

i'm trying your way these days, give me some time, if it works, i'll surely give you your points.

daisy
0
 
LVL 18

Expert Comment

by:bruno
ID: 6877272
Daisy,

Thanks for coming back and commenting, let me know if you have any problems.  


BRUNO
0
 
LVL 1

Expert Comment

by:NTIVER
ID: 6879712
Daisy:

The upload part will have to be done with some server side code as bruno suggests, but you could use javascript to populate text boxes with the two filenames you've browsed for if you wish.

If you're bored, give this a try and see what you think:

<html>
<head>
<script>
function populate_texts()
{
var selected1 = document.form1.file1.value
var selected2 = document.form1.file2.value

var seperated1 = selected1.split("\\");
var seperated2 = selected2.split("\\");

var no_of_sections1 = seperated1.length;
var no_of_sections2 = seperated2.length;

var last_portion1 = (no_of_sections1 -1);
var last_portion2 = (no_of_sections2 -1);

var filename1 = seperated1[last_portion1];
var filename2 = seperated2[last_portion2];

document.form1.text1.value = filename1
document.form1.text2.value = filename2
}
</script>
</head>
<body>
<form name="form1">
<input type="text" name="text1">&nbsp&nbsp<input type="file" name="file1">
<p>
<input type="text" name="text2">&nbsp&nbsp<input type="file" name="file2">
<p>
<input type="button" name="submitbutton" value="submit" onClick="populate_texts();">
</form>
</body>
</html>

All you'd need then is he active code to do the processing of the text boxes.

There's probably other ways, I was just killing time over a Lobster Thermidore luncheon :)

Neil
0
 
LVL 1

Expert Comment

by:Computer101
ID: 6881484
lexxwern,
Hello, I am Computer101, a Moderator on this site.  I have an issue with your comment.  What gives you the right to DEMAND that the questioner "give BRUNO the points before i copy and paste what he's written! ".  We are here to assit questioners, not demand things from them.  The questioner's history for accepting answers is not that great, but that give's you the right?  Also, what input to the questioners problem did you provide.  As I see it, nothing, so why did you post in this thread. I will monitor your actions and we will see how things go, but I ask that you tone things down.  If no related posts continue to be made, I will forward this to Admin for action.

Btw, I will not accept anymore comments in this questioner's thread concerning this but will open a question in Community Support concerning this matter.

Now DaisyWang, you do have open questions and I ask that you resolve those or I will have to go back to them and close them.

Thank you
Computer101
E-E Moderator
0
 
LVL 12

Expert Comment

by:lexxwern
ID: 6883148
Explanation and Clarifications Posted here
http://www.experts-exchange.com/questions/Q.20279061.html


--------------------COPY--------------------
 okay.
i better get to say something.

first thnx big rat.

Daisy Said " maybe you are same guy, haha :)"
*Please note 'haha'* and my reply
     " no im lexxwern
       bruno is not lexxwern
       also
       lexxwern is not bruno

       hope this helps, now DaisyWang you owe me points.

       lhn"
was in the same tone

my comments there were not demanding anything, my comments weren't even serious, i guess bruno got that
by his saying "lol...i lucked out and managed to be the first one here.  :-)".

as you first language english havers say, i was kidding.

i also acknowledge that my comments there were not related to the topic and i will prevent "cluttering"
in the future.
but i would not want people incharge here to believe that i was in any way demanding anything from EE
User DaisyWang.

now i would ask Computer101 to delete this thread if it has solved its purpose, since it is not doing
me any favours.

lexxwern.
--------------------END----------------------
0
 
LVL 2

Expert Comment

by:coreyit
ID: 6888132
Sorry to get off topic and back to DaisyWang's question, but...

it's my understanding that any form submission that includes files requires that
    enctype="mulitpart/form-data"
be added to the form tag.

Regarding the javascript form field population from NTIVER, no need: <input type="file"> provides it's own field that displays the path to the selected file.

-corey
0
 
LVL 1

Expert Comment

by:NTIVER
ID: 6888218
coreyit - I know, I was just stripping the path details so that the user could grab just the filename and extension.

I didn't know if it might be of use.

Neil :)
0
 
LVL 1

Expert Comment

by:Computer101
ID: 6923234
Daisy,
Any status.

Thank you
Computer101
E-E Moedrator
0
 
LVL 18

Expert Comment

by:bruno
ID: 6926663
C101, I think you know what I'm gonna say here....

DaisyWang, you've been blacklisted for giving a C grade and not giving a comment why.


BRUNO
0
 
LVL 1

Expert Comment

by:Computer101
ID: 6927210
After review, grade changed.

Computer101
E-E Moderator
0
 
LVL 18

Expert Comment

by:bruno
ID: 6927273
thanks.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question