Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

CGI and JAVASCRIPT

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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

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…
It is becoming increasingly popular to have a front-page slider on a web site. Nearly every TV website,  magazine or online news has one on their site, and even some e-commerce sites have one. Today you can use sliders with Joomla, WordPress or …
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…

722 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