Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Copy image from clipboard

39 views
Skip to first unread message

Stan4th

unread,
Jul 16, 2008, 5:25:51 AM7/16/08
to
Hi,
I have a requirement to allow the copying of a previously pasted image into
the web application - I assume using jscript (asp.net c# web app running on
an intranet).
Just to clarify - I know how upload from a graphics file on the client.
I have googled widely and realise this is not easy - but this is an
essential feature and its difficult explaining why this isn't simple when the
users are used to windows apps for which it is a trivial matter.
I am not permitted to install anything on the client machine - or if they
ever allowed me to(?) this would be a final final resort.
Thanks in advance!

Dave Anderson

unread,
Jul 16, 2008, 9:54:20 AM7/16/08
to
"Stan4th" wrote:
> I have a requirement to allow the copying of a previously pasted image
> into the web application - I assume using jscript (asp.net c# web app
> running on an intranet).

Paste an image from the clipboard into an application? I assume you don't
just want to display it, but actually capture it, in which case the browser
only offers you one option: <input type="file">. And those inputs cannot be
pre-populated or filled via scripting.

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.

Old Pedant

unread,
Jul 16, 2008, 3:30:13 PM7/16/08
to
It's all about security.

If what you are asking for were possible, then malicious web sites could
copy virtually any content from the clipboard or other windows to themselves
and who knows how much data would be compromised?

Dave Anderson is correct: The ONLY standard way to get a file from the
client machine to the server when using a browser is the <INPUT TYPE=FILE>
control. And that doesn't allow drag-drop because, within a browser, the
only way you can implement drag-drop (or copy from clipboard) is via
JavaScript and (again, as Dave said) you aren't allowed to script the <INPUT
TYPE=FILE> object.

So...

If this is a hard and fast requirement, your only solution will be to create
or find/buy a browser plug-in that is capable of this. And of course this
then requires EACH AND EVERY USER to allow the download and install of this
plug-in. Viable in an inTRAnet situation, if the installation is dictated by
management. Not really workable in inTERnet situation.

Your best choice, indeed, might be to stop trying to use a browser-based
solution and go to a windows-based solution. E.g., create a ".exe" program
that the users download and install. Of course, now that won't work in
non-Windows machines. But the odds are good that your browser plugin would
need to be browser-specific and machine-specific, so you are no worse off.
[There *IS* a possibility that you could use a Java Applet--Java, not
JavaScript--but again because of security restrictions each and every user
would have to accept the warnings and who knows what that using it would
engender. And that *assumes* that the user has Java installed and is
allowing Java applets in the browser, in the first place. I've never done
this, but I believe it is barely possible.]

0 new messages