Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Dynamic upload by html and javascript

Posted on 2004-03-29
8
Medium Priority
?
1,444 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
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
LVL 17

Assisted Solution

by:dorward
dorward earned 450 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 750 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

This guide will walk you through the essential considerations and tech stack for building scalable websites. Know how to grow your business the smart way!
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
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 the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Suggested Courses

877 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