开发者

How do I redirect to another php file while passing along $_FILES?

开发者 https://www.devze.com 2023-03-26 02:16 出处:网络
Ok, so I have a php api on one server used for uploading images, and I w开发者_如何学Pythonant it to redirect to another server while passing along the $_FILES data. I tried using the header() method,

Ok, so I have a php api on one server used for uploading images, and I w开发者_如何学Pythonant it to redirect to another server while passing along the $_FILES data. I tried using the header() method, but it seems $_FILES gets lost in the process. What would be the most straightforward solution?

Thanks!


best idea would be to

  • save image
  • send request to another server with link to current image
  • get image from target server
  • proccess image on target server
  • delete image from source server

It's nothing hard.


You can't redirect using existing POST (or FILES) data, only GET (the URL query string).

You can either save that data in session / disk / DB and reference it via a GET parameter.


You could serialize the $_FILES array, and pass it as a URL argument. But it wouldn't do you much good. The actual uploaded file's contents aren't included in this array; just the name and some metadata. Plus the file will be deleted at the end of the original script.

0

精彩评论

暂无评论...
验证码 换一张
取 消