A
A
Anastasia2021-07-10 13:33:08
PHP
Anastasia, 2021-07-10 13:33:08

How to download a file to temporary storage and get the url?

Hello.
There is a link to the audio file:
https://api.teleg.../file_20.oga
I need

  • upload it to a temporary file,
  • get a link to this file,
  • then send
  • and delete.

From the whole list, I only know how to send. Tell me how to upload to temporary files and get a link?

Why don't I ship right away?
This was originally done in order to receive an audio message in the cart as a file. I give him a voice message, and he gives me a file of his. But when I shove his own file to him, he swears Bad Request: failed to get HTTP URL content . But if I download this file with my hands and put a direct link to it, then it will send it without any problems.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
ThunderCat, 2021-07-10
@ThunderCat

file_get_contents()
file_put_contents()

get a link to this file
there is no need to be a genius here...
unlink() , although if you send a link to a file that you immediately delete, I think that this will be noble trolling...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question