473,385 Members | 1,384 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Javascript for Drag file From desktop and drop into webpage

Hi friends,

i need to drag a file from desktop and drop into web page.actually i had did a JS for dragging the images around the web page,but i dont know how to drag the file and drop it into web page.the js code for dragging around webpage is given below

[HTML]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Randy Bennett (rbennett@thezone.net) -->
<!-- Web Site: http://home.thezone.net/~rbennett/sitemap.htm -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
N = (document.all) ? 0 : 1;
var ob;
function MD(e) {
if (N) {
ob = document.layers[e.target.name];
X=e.x;
Y=e.y;
return false;
}
else {
ob = event.srcElement.parentElement.style;
X=event.offsetX;
Y=event.offsetY;
}
}
function MM(e) {
if (ob) {
if (N) {
ob.moveTo((e.pageX-X), (e.pageY-Y));
}
else {
ob.pixelLeft = event.clientX-X + document.body.scrollLeft;
ob.pixelTop = event.clientY-Y + document.body.scrollTop;
return false;
}
}
}
function MU() {
ob = null;
}

if (N) {
document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE | Event.MOUSEUP);
}
document.onmousedown = MD;
document.onmousemove = MM;
document.onmouseup = MU;
// End -->
</script>
</HEAD>

<BODY>
<div id="s" style="position:absolute;left:50;top:300;">
<img src=http://javascript.internet.com/img/cards/spades.gif name="s">
</div>

<div id="d" style="position:absolute;left:50;top:350;">
<img src=http://javascript.internet.com/img/cards/diamonds.gif name="d">
</div>

<div id="c" style="position:absolute;left:100;top:300;">
<img src=http://javascript.internet.com/img/cards/clubs.gif name="c">
</div>

<div id="h" style="position:absolute;left:100;top:350;">
<img src=http://javascript.internet.com/img/cards/hearts.gif name="h">
</div>

Just click and hold the 4 suit images to the left and then you can move them around the page!

<p><center>
<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>

</BODY>
</HTML>[/HTML]
please help me how to drag files from desktop
Dec 19 '06 #1
3 11825
steven
143 100+
You can't.

When you drag around images on your webpage, this is javascript controlling using the DOM to dynamically position html elements. Your desktop uses neither the HTML DOM nor Javascript.
Dec 19 '06 #2
hi friend,
thanks for replying.suppose we have textarea is there any javascript to get the path of the file that is to be dropped into browser text area from desktop.if yes please send me the script.its urgernt.
Dec 21 '06 #3
Yes you can do it in Javascript, I have found theese two links:
Internet Explorer
Firefox
Oct 19 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Paul | last post by:
Hi, Does anyone know how I would be able to drag a single file onto my applications icon and have it run some predefined code. What I want is to drop an .mp3 file onto my applications icon...
1
by: yma | last post by:
Hi, Can I use VS.net to debug the code in the JavaScript (.js) file? Thank you. Chris
2
by: NeverwaY | last post by:
Had an idea and wondered if it is possible at all. Dim Idea1 as New Idea Idea.show() ("I would like to have a spot on a Form, a box of some sort, that if you were to drag a file or folder on to...
8
by: ericgorr | last post by:
I have the following test page: http://ericgorr.net/test.html <html> <head><title>Simple JavaScript</title></head> <BODY ondragstart="alert(event.srcElement.tagName)"> <INPUT TYPE=text...
6
by: popnbrown | last post by:
the title says it how do i put a .swf file on a webpage? I know i'm a noob thank you. Plz help and appreciate it.
2
by: Naha | last post by:
Hi Guys, Does anyone know how to display data from a text file onto a webpage? So far I have opened and read the data in the text file and printed it out on command line, but I am having...
1
by: davidemazza82 | last post by:
Hi all, I got an from IE 7.0.5730.11 when moving the <script src="..." type="text/javascript" /tag from the <headpart to the <bodysection of a HTML file. Is not possibile to include...
5
by: Oriane | last post by:
Hi there, I would like to run a javascript file directly from the desktop, like a VBScript file. So my post is perhaps "out of topic" in which case I apologize. The goal is to run this sort...
0
by: chris52672 | last post by:
I have a list view box that shows the files in a directory. I want to drag from the list box to an e-mail window or an explorer window (file folder) and have the file copied to there. Here are the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.