1

Is it possibile to read uploaded file by protocol php://fd/?

For example:

<?php
    echo file_get_contents('php://fd/1'); // I quess file descriptor (1) is the name of file input ?>

<form method="post" enctype="multipart/form-data">
    <input type="file" name="1"/>
    <input type="submit" value="ok"/>
</form>
5
  • I can use "php://input" I asked becouse I need to get clear text "something" which is in file. I can use char '\0' to manipulate result but php://fd/ would me simplest way.. Commented May 22, 2012 at 11:56
  • 1
    I think what you're looking for is $_FILES - Also this Commented May 22, 2012 at 11:57
  • 1
    :) I know how to upload file. I am just wonder about this case Commented May 22, 2012 at 12:09
  • Well, I guess you could eat soup with a knife, but why bother when you're given a spoon... :) Commented May 23, 2012 at 1:27
  • check this Commented Feb 4, 2019 at 17:49

2 Answers 2

1

php://fd expects file descriptor. I think you have to create one with fopen on uploaded file and then use it's id.

Sign up to request clarification or add additional context in comments.

Comments

0

Try

<?php echo file_get_contents($_FILES["1"]["tmp_name"]); ?>

1 Comment

Yes, I know.. But could you tell me is it possible to use php://fd? Is name of input is file descriptor?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.