0

So i have an apache server set up and running, but I want people to be able to download files with an URL query, like apache.com/get?cat.png will return file named cat.png in a folder if it exists and error if it doesn't? I'm very new on this, forgive me on any mistakes I have

Eric OUUU
  • 23
  • 1
  • 4
  • Hi, welcome to Stackoverflow! Can you share some code with us so we can see what you've already tried, and what will fit best with your code? Thanks! – sigma1510 Mar 09 '21 at 13:37
  • emm Hello, I have tried nothing yet since I can't find any documents that seemed useful, and I came here because I had no clue at all on how to start doing it at all, figuring I would come here to get some resources to start with – Eric OUUU Mar 10 '21 at 14:05
  • Well, to start, is your cat.png file already on your server? If yes, one of these solutions might work for you: https://stackoverflow.com/questions/45758729/can-you-make-a-file-downloadable-through-apache – sigma1510 Mar 10 '21 at 18:17
  • so basically I want the user to access to say, example.com/foo.php?file=document.png&token=RandomToken, and the file would receive the file parameter and token in a function, and be able to return a file. Edit: Sorry for the broken English, I'm not good at typing long sentences – Eric OUUU Mar 12 '21 at 18:36
  • so I would have like file SomeFunction(string file,string token) { //handle data return file; } is that possible? I'm unfamiliar with websites in general – Eric OUUU Mar 12 '21 at 18:45
  • All right, first things first: you mentioned you have an apache server set up and running. How did you set that up, and what OS are you using? – sigma1510 Mar 13 '21 at 19:29
  • I'm currrently running it on windows but it's trivial to migrate it to ubuntu if need be, for windows I used apache louge and for ubuntu I just use the standard installation – Eric OUUU Mar 15 '21 at 10:57
  • And is the file you want to download on your server? – sigma1510 Mar 15 '21 at 12:27
  • yes, I just want to use it as a way to share files with my friend – Eric OUUU Mar 16 '21 at 13:06

0 Answers0