Solved

How to upload local file?

Posted on 2002-03-12
19
162 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
  • 7
  • 4
  • 3
  • +3
19 Comments
 
LVL 18

Accepted Solution

by:
bruno earned 50 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
 

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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
spacing 5 27
AngularJS/ HTML - Filtering ng-repeat by dates 32 29
Syntax Error 6 30
HTML page and JavaScript 2 50
Do you want to insert HTML5 video into your site? This is the tutorial how to do so. What are the main advantages of HTML5 video? 1) Have good compression, good image quality, and low decode processor use. 2) It is royalty-free 3) It is easi…
This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…

708 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now