naeembhatti
asked on
how can i save my images through javascript into my selected directory?
sir i have code this---
<body>
<img src="images/www.bikao.com/2.gif" />
<script language="javascript">
javascript:Ai7Mg6P='';
for (i7M1bQz=0;i7M1bQz<documen t.images.l ength;i7M1 bQz++){
Ai7Mg6P+='<img src='+document.images[i7M1 bQz].src+' ><br>';
images = document.images[i7M1bQz].s rc;//mine
};
if(Ai7Mg6P!=''){
//document.write('<center> '+Ai7Mg6P+ '</center> ');
alert(images);//save all images here in 'images directory'
void(document.close());
}else{
alert('No images!');
}
</script>
</body>
i want to save all images in images directory where i am doing alert how can it would be done plz plz help me today is the dead line of the project just i have to save them all.
thanks in advance.
<body>
<img src="images/www.bikao.com/2.gif" />
<script language="javascript">
javascript:Ai7Mg6P='';
for (i7M1bQz=0;i7M1bQz<documen
Ai7Mg6P+='<img src='+document.images[i7M1
images = document.images[i7M1bQz].s
};
if(Ai7Mg6P!=''){
//document.write('<center>
alert(images);//save all images here in 'images directory'
void(document.close());
}else{
alert('No images!');
}
</script>
</body>
i want to save all images in images directory where i am doing alert how can it would be done plz plz help me today is the dead line of the project just i have to save them all.
thanks in advance.
ASKER
sir i have modify my code like this
fso = new ActiveXObject("Scripting.F ileSystemO bject");
javascript:Ai7Mg6P='';
for (i7M1bQz=0;i7M1bQz<documen t.images.l ength;i7M1 bQz++){
Ai7Mg6P+='<img src='+document.images[i7M1 bQz].src+' ><br>';
images = document.images[i7M1bQz].s rc;//mine
};
if(Ai7Mg6P!=''){
//document.write('<center> '+Ai7Mg6P+ '</center> ');
//alert(Ai7Mg6P+'-'+images );
fso.CopyFile (images, 'images/'+images);
//alert(images);
void(document.close());
}else{
alert('No images!');
}
i know it would not run on every browser but i when i run it on firefox it does not copy my image and if i run on ie(but not my requirement for ie) it gives my error "automation server can't create object"
??
fso = new ActiveXObject("Scripting.F
javascript:Ai7Mg6P='';
for (i7M1bQz=0;i7M1bQz<documen
Ai7Mg6P+='<img src='+document.images[i7M1
images = document.images[i7M1bQz].s
};
if(Ai7Mg6P!=''){
//document.write('<center>
//alert(Ai7Mg6P+'-'+images
fso.CopyFile (images, 'images/'+images);
//alert(images);
void(document.close());
}else{
alert('No images!');
}
i know it would not run on every browser but i when i run it on firefox it does not copy my image and if i run on ie(but not my requirement for ie) it gives my error "automation server can't create object"
??
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
okey right i got it but e.g
if i have a singel file named as images.html
and code is simple this
<script type="text/javascript">
var fso = new ActiveXObject("Scripting.F ileSystemO bject");
fso.CopyFile("E:\AppServ_5 \www\pligg \test\9.gi f", "E:\AppServ_5\www\pligg\te st\images/ 9.gif");
</script>
why this code is not running this is not .hta ?
or what could be other methods or example to copy file through javascript plz plz help me.
if i have a singel file named as images.html
and code is simple this
<script type="text/javascript">
var fso = new ActiveXObject("Scripting.F
fso.CopyFile("E:\AppServ_5
</script>
why this code is not running this is not .hta ?
or what could be other methods or example to copy file through javascript plz plz help me.
Hi.
How about
<HTML>
<HEAD>
<TITLE>HTA Demo</TITLE>
<HTA:APPLICATION ID="oHTA"
APPLICATIONNAME="myApp"
BORDER="thin"
BORDERSTYLE="normal"
CAPTION="yes"
ICON=""
MAXIMIZEBUTTON="yes"
MINIMIZEBUTTON="yes"
SHOWINTASKBAR="no"
SINGLEINSTANCE="no"
SYSMENU="yes"
VERSION="1.0"
WINDOWSTATE="maximize"/>
<SCRIPT>
function window.onload () {
var fso = new ActiveXObject("Scripting.F ileSystemO bject");
fso.CopyFile("E:\\AppServ_ 5\\www\\pl igg\\test\ \9.gif", "E:\\AppServ_5\\www\\pligg \\test\\im ages\\9.gi f");
}
</SCRIPT>
</HEAD>
<BODY><P>File copied.</P></BODY>
</HTML>
? The script is partly refered to http://msdn.microsoft.com/workshop/author/hta/reference/objects/hta.asp . Also look out for backslashes in Javascript: it's an escape character, and to say a normal "\" you'll need two: "\\".
I haven't tested the above script.
How about
<HTML>
<HEAD>
<TITLE>HTA Demo</TITLE>
<HTA:APPLICATION ID="oHTA"
APPLICATIONNAME="myApp"
BORDER="thin"
BORDERSTYLE="normal"
CAPTION="yes"
ICON=""
MAXIMIZEBUTTON="yes"
MINIMIZEBUTTON="yes"
SHOWINTASKBAR="no"
SINGLEINSTANCE="no"
SYSMENU="yes"
VERSION="1.0"
WINDOWSTATE="maximize"/>
<SCRIPT>
function window.onload () {
var fso = new ActiveXObject("Scripting.F
fso.CopyFile("E:\\AppServ_
}
</SCRIPT>
</HEAD>
<BODY><P>File copied.</P></BODY>
</HTML>
? The script is partly refered to http://msdn.microsoft.com/workshop/author/hta/reference/objects/hta.asp . Also look out for backslashes in Javascript: it's an escape character, and to say a normal "\" you'll need two: "\\".
I haven't tested the above script.
ASKER
hmm no it is not copying the image.
ok let me think some other alternates for it.
ok let me think some other alternates for it.
Unless it is a .hta application I doubt that browser will allow this... Anyway here is a small sample(s)
[JScript]
fso = new ActiveXObject("Scripting.F
fso.CopyFile ("c:\\mydocuments\\letters
[VBScript]
FileSystemObject.CopyFile "c:\mydocuments\letters\*.
HTH
I