Dador
Dador

Reputation: 5425

Read local file without open dialog (in browser)

There is any way (from browser) to read local file without open dialog?

Can be used: javascript, flash, or java.

Goal: when you paste text in WYSIWYG with images from MS Word, there will be links to image files. Like "file:///C:/Users/username/AppData/Local/Temp/msohtmlclip1/01/clip_image001.jpg". I want to read this files, upload to server and replace local path.

Upvotes: 1

Views: 641

Answers (2)

SJuan76
SJuan76

Reputation: 24895

Accessing the disk contents from the browser without the user permission is a security risk. As such, to do that with Java you need your applet signed and the user allowing it to run.

Upvotes: 2

DeejUK
DeejUK

Reputation: 13501

A Java applet can do this, but it would need to be signed with an SSL certificate from a trusted authority, otherwise the applet would not be run with a security exception thrown.

You'd use any standard Java approach to loading and uploading the file (Apache Commons FileUtils and HttpClient?); if you're new to Java then there may be simpler solutions.

Upvotes: 2

Related Questions