Jump to content

Firefox Mozilla Relative Path

- - - - -

  • Please log in to reply
5 replies to this topic

#1
batowiise

batowiise

    Newbie

  • Members
  • PipPip
  • 17 posts
Hi all,

i have a script that is suppose to allow download i however get an alert from Firefox Mozilla." Firefox doesn't know how to open this address, because the protocol © isn't associated with any program" . Upon further investigation, i got to know that "C:/upload_test/$code/$file" is not a registered protocol and that i need to give a relative path to "C:/upload_test/$code/$file".

My code is as follows:

echo "<center><a href='C:/Upload_test/$code/$file' target='_blank'>Download Attached File</a></center>";

How do i go about the relative path?

Regards

#2
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts
  • Location:Vancouver, Eh! Cleverness: 200
I've forgot what Windows uses, I have no PC to test right now - I think it is one of these two:

echo "<center><a href='file:///C:/Upload_test/$code/$file' target='_blank'>Download Attached File</a></center>";  
echo "<center><a href='C:\\Upload_test\\$code\\$file' target='_blank'>Download Attached File</a></center>";

Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#3
batowiise

batowiise

    Newbie

  • Members
  • PipPip
  • 17 posts
when i used your solution, the alert did not come up but the file could not be downloaded.

#4
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
Is there a reason why you are downloading a file that is already on your hard drive?
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#5
batowiise

batowiise

    Newbie

  • Members
  • PipPip
  • 17 posts
Yes, i want to demonstrate that the file can be opened/downloaded through the browser.
Actually this is a file that has been attached by userA and userB would like to download and view its content.
That is the logic

#6
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts
  • Location:Vancouver, Eh! Cleverness: 200
It was a mix between the two, I am on a Windows computer now. This works fine:
file:///C://windows//system.ini

Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users