file_get_contents(): failed to open stream: No such file or directory

Tom

I'm making a multiple images upload system in php. This is what I have:

PHP

foreach($_FILES['files']['tmp_name'] as $key => $name_tmp)
{
        $name = $_FILES['files']['name'][$key];
        $tmp_name = $_FILES['files']['tmp_name'][$key];
        $type = $_FILES['files']['type'][$key];
        $size = $_FILES['files']['size'][$key];
        $image = addslashes(file_get_contents($name));

        $query2 = mysql_query("INSERT INTO afbeeldingen(naam, afbeelding) values ('$name', '$image')");
}

HTML

<input type="file" name="files[]" multiple>

Now if I add one or more files via the input form, I get the following error:

Warning: file_get_contents(download (1).jpg): failed to open stream: No such file or directory in D:\Apps\Xampp\htdocs\el_gusto\toevoegen_handler.php on line 578

What I'm I doing wrong? I'm only inserting the name & image for now.

Thanks in advance and taking time to read this!

Kind Regards

Anonymous

Use $tmp_name when calling file_get_contents(). This is the actual location of the file on disk until the end of the request. $name contains the original name of the uploaded file in case you need it.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

file_get_contents(): failed to open stream: No such file or directory

From Dev

file_get_contents() failed to open stream: No such file or directory

From Dev

file_get_contents failed to open stream only with multiple

From Dev

PHP - file_get_contents failed to open stream: Connection closed?

From Dev

file_get_contents with http - Failed to open stream

From Dev

How to resolve the error "[ErrorException] file_get_contents(/var/www/laravel/.env): failed to open stream: No such file or directory"?

From Dev

Failed to open stream: No such file or directory

From Dev

failed to open stream: No such file or directory

From Dev

file_get_contents() how to fix error "Failed to open stream", "No such file"

From Dev

failed to open stream: Permission denied file_get_contents which generates XML FILE

From Dev

failed to open stream: Permission denied file_get_contents which generates XML FILE

From Dev

file_get_contents failed to open stream: HTTP request failed only for SPECIFIC web page

From Dev

file_get_contents failed to open stream: HTTP request failed! HTTP/1.1 463

From Java

PHP - Failed to open stream : No such file or directory

From Java

failed to open stream: No such file or directory (Laravel)

From Dev

SplFileObject error failed to open stream: No such file or directory

From Dev

PHPUnit error "Failed to open stream: No such file or directory"

From Dev

PHP - failed to open stream: No such file or directory in

From Dev

PHP/SQL - failed to open stream: No such file or directory

From Dev

failed to open stream: No such file or directory issue

From Dev

Creating Child Theme. "Warning: file_get_contents9():failed to open stream: No such file or directory" Error

From Dev

Telegram Bot PHP: Warning: file_get_contents failed to open stream: 400 Bad Request

From Dev

PHP error doing file_get_contents on a Hostinger host: failed to open stream

From Dev

PHP error doing file_get_contents on a Hostinger host: failed to open stream

From Dev

PHP: file_get_contents(): failed to open stream error - works on test XAMPP test server, not live

From Dev

I keep getting this error file_get_contents(failed to open stream: HTTP request failed! HTTP/1.1 400 BAD REQUEST

From Dev

"file_get_contents(http://127.0.0.1:8000/storage/config/xxx.ini): failed to open stream: HTTP request failed! "

From Dev

move_uploaded_file(...): failed to open stream: No such file or directory

From Dev

File exists but PHP throwing "failed to open stream: no such file or directory"

Related Related

  1. 1

    file_get_contents(): failed to open stream: No such file or directory

  2. 2

    file_get_contents() failed to open stream: No such file or directory

  3. 3

    file_get_contents failed to open stream only with multiple

  4. 4

    PHP - file_get_contents failed to open stream: Connection closed?

  5. 5

    file_get_contents with http - Failed to open stream

  6. 6

    How to resolve the error "[ErrorException] file_get_contents(/var/www/laravel/.env): failed to open stream: No such file or directory"?

  7. 7

    Failed to open stream: No such file or directory

  8. 8

    failed to open stream: No such file or directory

  9. 9

    file_get_contents() how to fix error "Failed to open stream", "No such file"

  10. 10

    failed to open stream: Permission denied file_get_contents which generates XML FILE

  11. 11

    failed to open stream: Permission denied file_get_contents which generates XML FILE

  12. 12

    file_get_contents failed to open stream: HTTP request failed only for SPECIFIC web page

  13. 13

    file_get_contents failed to open stream: HTTP request failed! HTTP/1.1 463

  14. 14

    PHP - Failed to open stream : No such file or directory

  15. 15

    failed to open stream: No such file or directory (Laravel)

  16. 16

    SplFileObject error failed to open stream: No such file or directory

  17. 17

    PHPUnit error "Failed to open stream: No such file or directory"

  18. 18

    PHP - failed to open stream: No such file or directory in

  19. 19

    PHP/SQL - failed to open stream: No such file or directory

  20. 20

    failed to open stream: No such file or directory issue

  21. 21

    Creating Child Theme. "Warning: file_get_contents9():failed to open stream: No such file or directory" Error

  22. 22

    Telegram Bot PHP: Warning: file_get_contents failed to open stream: 400 Bad Request

  23. 23

    PHP error doing file_get_contents on a Hostinger host: failed to open stream

  24. 24

    PHP error doing file_get_contents on a Hostinger host: failed to open stream

  25. 25

    PHP: file_get_contents(): failed to open stream error - works on test XAMPP test server, not live

  26. 26

    I keep getting this error file_get_contents(failed to open stream: HTTP request failed! HTTP/1.1 400 BAD REQUEST

  27. 27

    "file_get_contents(http://127.0.0.1:8000/storage/config/xxx.ini): failed to open stream: HTTP request failed! "

  28. 28

    move_uploaded_file(...): failed to open stream: No such file or directory

  29. 29

    File exists but PHP throwing "failed to open stream: no such file or directory"

HotTag

Archive