Solved

CGI and JAVASCRIPT

Posted on 1997-10-31
1
129 Views
Last Modified: 2013-12-25
I want to upload file from client to server in javascript
0
Comment
Question by:masseport
1 Comment
 
LVL 6

Accepted Solution

by:
alamo earned 50 total points
Comment Utility
You can use a form with an input field of type "file" to post a file to a CGI script, e.g.

<form name="frm" action = "http://etc" METHOD="POST" ENCTYPE="multipart/form-data">
  File: <INPUT NAME="thefile" TYPE=FILE> <INPUT TYPE=SUBMIT VALUE="Upload">
</form>

You can activate this like via Javascript like any form:

document.frm.submit()

What you can't do, though, is set or get the value of the filename. The user must do this manually. The reason for this is obvious: it would allow a malicious javascript program to upload any file it wanted.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Ever wondered how to display how many visitors you have online. In this tutorial I will show you an easy but effective way to display the number of online visitors in WhizBase. In this article I assume you have read my previous articles and know …
Making a simple AJAX shopping cart Couple years ago I made my first shopping cart, I used iframe and JavaScript, it was very good at that time, there were no sessions or AJAX, I used cookies on clients machine. Today we have more advanced techno…
The viewer will learn how to dynamically set the form action using jQuery.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

762 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

6 Experts available now in Live!

Get 1:1 Help Now