Solved

Dynamic upload by html and javascript

Posted on 2004-03-29
8
1,439 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
[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
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
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Introduction In this tutorial, I'll explain how to create an animated progress meter in a wireframe prototype developed using Axure RP 7.0 - a leading prototyping tool for designing web sites and software. (For more information about Axure and gett…
Objective of This Article In 1990’s, when I was a budding software professional, I had a lot of confusion about which stream or technology, I had to choose to build my career. In those days, I had lot of confusion like whether to choose System so…
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 the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

710 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