Solved

CGI and JAVASCRIPT

Posted on 1997-10-31
1
140 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
ID: 1831023
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Ned Perl Snippet to Read Files in Directory 5 74
importing users to Security group 2 58
Bulk Reorder File Names 4 69
Debug script powershell wmi 3 16
This tutorial will discuss the log-in process using WhizBase. In this article I assume you already know HTML. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you might look at some of my other articles abo…
This article will show, step by step, how to integrate R code into a R Sweave document
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)

830 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