Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6617115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:39:57+00:00 2026-05-25T20:39:57+00:00

I need to get a file from the server and I’m doing it like

  • 0

I need to get a file from the server and I’m doing it like this:

file_get_contents($path.$fileName);

It works well with most of the files, until I started experiencing some issues in particular cases like the following:

Where the $path is a string like this: "/path/to/app/and/file/folder/" (not a url but a realpath)

and $fileName is: "PCard__0000_Front_(2).jpg"

The error I get is:

/path/to/app/and/file/folder/PCard__0000_Front_(2).jpg)
[function.file-get-contents]: failed to open stream: No such file or
directory

Now if I call the function with a string: file_get_contents("/path/to/app/and/file/folder/PCard__0000_Front_(2).jpg") it works well

Please some advise on what am I doing wrong, I would really like to understand why this happens.

Thanks!

P.S. I have seen some others say to use curl instead but I would really appreciate if someone could shed some light into why this is happening and how can I solve it using file_get_contents no matter how much better the other function could be.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T20:39:57+00:00Added an answer on May 25, 2026 at 8:39 pm

    Judging by the output of the error message with the filename showing, PCard__0000_Front_(2).jpg

    perhaps there’s a need for urldecode($filename)


    SOLUTION

    As suggested by a comment (thank you) the solution for the proper file name would be

    html_entity_decode($filename)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to stream a media file from another server through this php file.
I need to get a file from sourcesafe database programmatically. Any idea of how
I've need to get a file from a remote (embedded) system (which I can
I need to get the File version information from an exe file originally written
I need a little help here: I get a file from an HTML upload
I need a quick easy way to get a string from a file in
In C#, Whenever i need to get file path more dyanmically, i do something
I'm trying to get the contents from another file with file_get_contents (don't ask why).
I need to get rather complicate JSON data from (large) JSON file into a
I need to have image file path from the user and store the image

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.