Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

CGI and JAVASCRIPT

Posted on 1997-10-31
1
Medium Priority
?
159 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This tutorial will discuss fancy secure registration forms, with AJAX technology support. In this article I assume you already know HTML and some JS. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you mig…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

971 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