Solved

Dynamic upload by html and javascript

Posted on 2004-03-29
8
1,434 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
Comment Utility
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
Comment Utility
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
Comment Utility
sorry, but you can't.
0
 
LVL 17

Assisted Solution

by:dorward
dorward earned 150 total points
Comment Utility
No, there is no way to circumvent the security and allow page authors to specify which files should be uploaded from the client.
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

Author Comment

by:petrusko
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Most of the sites are being standardized with W3C Web Standards. W3C provides lot of web standard services to the web. They have the web specification, process and documentation for all the web standards. You can apply HTML, CSS and Accessibility st…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

763 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now