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

x
?
Solved

Dynamic upload by html and javascript

Posted on 2004-03-29
8
Medium Priority
?
1,442 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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…

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