Solved

CGI and JAVASCRIPT

Posted on 1997-10-31
1
145 Views
Last Modified: 2013-12-25
I want to upload file from client to server in javascript
0
Comment
Question by:masseport
[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
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

Is Your DevOps Pipeline Leaking?

Is your CI/CD pipeline a hodge-podge of randomly connected tools? You’ve likely got a tool to fix one problem & then a different tool to fix another, resulting in a cluster of tools with overlapping functionality. Learn how to optimize your pipeline with Gartner's recommendations

Question has a verified solution.

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

In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
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…

734 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