Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

script to open any file 1

Status
Not open for further replies.

sramey00

Programmer
Jun 9, 2004
149
US
im having trouble trying to open a file. it exists on the server and through asp, im creating a form with a radio button. click the button and that file opens inside it's program. (file name is dynamically assigned to the buttons value)
intially i tried using the wscript.createobject("wscript.wshell"), but the generated an error. (wscript needed or something like that)
then i tried server.createobject... didn't work either.
then tried just createobject. error (activexobject can't create...)

i found this code somewhere
Code:
var oShell = new ActiveXObject("Shell.Application");
			oShell.ShellExecute(document.Form1.elements(i).value,"","","open","1");

and i generate a permissions denied error.

without changing the browsers permission (if thats why the error is generrated) how can i open this file on the clients computer? (again file located on server)


Mr. Steve

 
is the OS XP???

this is actually a security patcht in later versions IE. it DOES not allow u to open any files on the client system (makes sense as its a dangerous security issue)...

Known is handfull, Unknown is worldfull
 
no, its not XP... i have a previously written script in vb that can access the server fine when i double click the file. do you think i can reference to that file and pass it a parameter?

Mr. Steve

 
nope,
what version of IE are u using???

Known is handfull, Unknown is worldfull
 
yup,
i am sure its the security patch, try in lower versions and see if the code works in them...

Known is handfull, Unknown is worldfull
 
eh. not even worth trying. its a knowledge base website that needs to be able to view uploaded files.

problem is when the file is opened through the browser, the save command isn't accessible because the website uses frames. if i open the file inside a nother browser, that should do the trick right?

thats the statement id want...
Code:
window.open();
however, what would the syntax be for the file?

is it...
Code:
window.open('\\dcsqldev\upload\' & document.Form1.elements(i).value)

i know the url goes in the ' ' ,but since its dynamically obtained, is that the correct syntax?

Mr. Steve

 
oops,
i made a mistake, i read the post wrongly (i thought u wanted to access a file on the client's system)

yes, the window.open command would do it.

i really am sorry...

Known is handfull, Unknown is worldfull
 
well id rather open the file inside its designated program (not in another window), this possible or does the security patch hamper this?

Mr. Steve

 
u could use IFRAMES:
<iframe name="InlineFrm" src="">

to load a value:
parent.frames.InlineFrm.location.href='\\dcsqldev\upload\' + document.Form1.elements(i).value

hey i noticed one more thing, its + and not &....

Known is handfull, Unknown is worldfull
 
silly vb practices...

with this window.open function

i think im messing up the syntax cuz im receiving an error inbetween the ' '. stating 'expected hexidecimal digit'.

Code:
window.open('\\dcsqldev\upload\' + document.form1.elements(i).value);

im thinking it has to do with those quotes.

i dotn want to get too complicated with iframes, if i dont ahve to!

Mr. Steve

 
aha!!!

window.open('\\\\dcsqldev\\upload\\' + document.form1.elements(i).value);

\ is escape character and therefore itself has to be escaped...

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top