Solved

Dynamic upload by html and javascript

Posted on 2004-03-29
8
1,437 Views
Last Modified: 2013-12-16
Hello!

Situation is next:

I would like to build a form into wich users will be able to paste pictures from Word (Equation).

So I've bulild a div and the pasting is ok, I've created a javascript function which returns me a filename with path - on clientside.

I would like to upload that file on server, but the value property in INPUT="FILE" tag is read only?

Any sugestions
0
Comment
Question by:petrusko
8 Comments
 
LVL 30

Expert Comment

by:third
ID: 10702836
for security reasons, file input forms are set to read-only, otherwise web servers can easily grab files from the client without the user knowing it.
0
 

Author Comment

by:petrusko
ID: 10702988
Yes I know that - but isn't there another way?

Let's say: my users that will be uploading an image, aren't wery bright, so looking for file in filesystem is a problem. Especialy looking for a file in "C:\Desktop and Settings\username\Local settings\Temp\msohtml\xx\some_clip.gif".

Is possible to create some javascript or .NET function to write the filename into a textbox or something? And then by submitting (by the user) upload file into server.

Would be possible to create a javascript function which will simulate typing a filename into a fileupload textbox?

LP Peter
0
 
LVL 30

Expert Comment

by:third
ID: 10703100
sorry, but you can't.
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
LVL 17

Assisted Solution

by:dorward
dorward earned 150 total points
ID: 10703195
No, there is no way to circumvent the security and allow page authors to specify which files should be uploaded from the client.
0
 

Author Comment

by:petrusko
ID: 10703537
ok! What can't be done just can't be done.

 I'will change the question?

Let's assume that a user copies a picture from M$Word into WYSIWYG  javascript editor or <div> or <span> area - is possible to grabthe data that and upload it into server?

I can get the M$Word generated HTML, but can I get the copied data into server.
LP Peter
0
 
LVL 53

Accepted Solution

by:
COBOLdinosaur earned 250 total points
ID: 10705890
Instead of putting it into a div you could put the HTML generated by Word into a textarea.  That would preserve the code that renders the presentation, but you would still not get data. You are going to run into the limitation no matter what you try to do. Security is not going to allow a file update without the user specifically selecting the file after clicking a browse button.

If you know what the name of the file they need is, then display it for them. After they select the file you can check to see if they have selected the correct one.  If they have not; then instead of uploading give them an error message and let them keep trying until they get it right.

Cd&
0
 

Author Comment

by:petrusko
ID: 10711329
I'm not very happy about answers - there are so many holes in M$ technology but it looks that this has been sealed.

I'm going to split the points.

Thanx guys!

by Peter
0
 
LVL 1

Expert Comment

by:hallvord
ID: 10893870
I assume you don't have the option to make users upgrade to other browsers than IE ;-) Just FYI: Opera handles this differently. You are allowed to set the file element's value from JavaScript but when the form is submitted Opera will warn the user and ask them to confirm sending the file.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone 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

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

856 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