Amin El-Zein
asked on
donwload file script
hello,
I have an IIS server and I have some files hosted on it.
I want to make sure users can download these files with user name and password parameters given in the URL, for example:
So I don't want anyone to get access to the file without including his information.
Any opensource or script can do that?
Thanks.
I have an IIS server and I have some files hosted on it.
I want to make sure users can download these files with user name and password parameters given in the URL, for example:
http://files.mydoamin/list.txt?username:user?password:pwd
So I don't want anyone to get access to the file without including his information.
Any opensource or script can do that?
Thanks.
ASKER
how i can do it ?
Hi there I left you in the last comment the way to do it :)
https://stackoverflow.com/questions/10937524/how-should-i-pass-multiple-parameters-to-an-asp-net-web-api-get
here's a video
https://www.youtube.com/watch?v=AJWwQEXd4Yk (at least the english can be understandable) :)
https://stackoverflow.com/questions/10937524/how-should-i-pass-multiple-parameters-to-an-asp-net-web-api-get
here's a video
https://www.youtube.com/watch?v=AJWwQEXd4Yk (at least the english can be understandable) :)
ASKER
is there any easy php script to do that ? or any open source script that can do it ?
thanks
thanks
Hi Amin,
I try to do an exmple of what you need to do:
I try to do an exmple of what you need to do:
<?php
if (isset($url)) {
if (isset($_GET['username']) && isset($_GET['password'])){
// if the log is correct
echo '<form action="yourscript.php" method="post">
<input type="button" class="btn btn-default" onclick="window.location=\'file.txt\'" value="exportTXT">
</p>
</form>';
} else {
// log fail... retry
header('Location: index.php');
exit();
}
}
?>
Hope this will help you.
ASKER
is it the full script ? or I have to make other pages ?
It's an exemple, to how you have to do this:
You have to implement with your code where I put the comment.
You have to implement with your code where I put the comment.
ASKER
I am not a developer , I want your help to make my request work.
thanks.
thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
What you need to do is to implement an API.
The API will receive both parameters and you can do a simple file where you can have "username and password"
So every time you get a call
https://myweb.com?username:user1&password:pwd1 (works)
https://myweb.com?username:user1 (fail missing password)
https://myweb.com?password:pwd1 (fail missing username)
https://myweb.com (fail missing both username and pwd).
Check if the request has the username and password and also make sure that they're valid.
Once this is checked it can download the file.
https://stackoverflow.com/questions/10937524/how-should-i-pass-multiple-parameters-to-an-asp-net-web-api-get