Questions tagged [pathinfo]
85 questions
0
votes
1 answer
CodeIgniter 2 no longer able to use PATH_INFO after modifying .htaccess
I'm brand new to CI and I'm trying to remove the annoying "index.php" from the URLs. This is the .htaccess I'm using:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$…

Throwaway
- 11
- 4
0
votes
1 answer
Php - reading and displaying multiple file type
I'm building a simple chat box(no database, inputs are saved as txt file and images) for my website where users can share image and send text.
Here's what I've came up so far:
$log = glob(__DIR__.'/chatlog/*');
foreach($log as $file){
…

Bob D. Builder
- 75
- 7
0
votes
0 answers
GET File extension on php
i have 2 fields on my project to upload documents(pdf, words) i use the following code to get the file extension on upload and rename the file with my custom name:
$ext= pathinfo($rsnew["File"], PATHINFO_EXTENSION);
my problem that i need to add to…

Christ2000
- 21
- 4
0
votes
0 answers
Nginx + phpFPM | DEBIAN 10 | PATH_INFO is always empty
I've already looked at the proposed solutions on stackoverflow and I didn't find anything that solved my problem:
Nginx + phpFPM: PATH_INFO always empty
PATH_INFO in $_SERVER always empty - NGINX + FPM 7.3 + Ubuntu 18.04
Nginx config rewrite with…

Nicolas
- 1
- 4
0
votes
1 answer
How to display a replacement image when one is not found in PHP?
I have a first PHP script that allows me to display an image on a remote server. This one works and I'd like to make a condition so that when it doesn't find the image in the $file variable it displays the image in the $newfile variable instead.
But…
user12886821
0
votes
1 answer
Can't get file name and extension in variable in laravel controller?
Can't get file name and extension in the variable "$fileNameToStore" but it is able to save default image name {'noimage.jpg'} in database.
i want to know what is the cause for that.
public function store(Request $request)
{
…

kianoosh Azarvandi
- 31
- 2
- 11
0
votes
3 answers
How do I correctly display a file extension from an HTML POST file using PHP?
I am attempting to echo the extension of an uploaded tax document. The document can be any image or a pdf. I plan on using the extension to rename the file with its proper extension later in the code.
Currently it does not echo the extension.
I have…

Dfuce
- 25
- 3
0
votes
1 answer
How to use pathinfo in php?
I am working on a php code as shown below on which Line#A prints the following array (shown below php code). My code doesn't seems to go inside switch statement. I am not sure why.
I added print_r($parts) at Line A in order to print the value of…

flash
- 1,455
- 11
- 61
- 132
0
votes
0 answers
Cann't check a file extension in php
The case statement in php here to check a mime type is working fine.
$mimetype = mime_content_type($path);
switch ($mimetype) {
case "video/mp4":
case "video/mov":
~~~~~~~~~~~~~~~~~
However, the case statement in php here to check a file…

user27240
- 49
- 10
0
votes
3 answers
CodeIgniter : No input file specified : PATH_INFO : $_GET
when I use:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|favicon\.ico|robots\.txt|class|style|js)
RewriteRule ^(.*)$ /index.php/$1 [L]
in .htaccess and:
$config['uri_protocol'] = "PATH_INFO";
in config.php
the result is:
MY WINDOWS SERVER…

Marcin Majchrzak
- 662
- 1
- 11
- 22
0
votes
0 answers
An alternative way of getting the file extension of a user uploaded image in PHP?
I'm trying to get a file extension of a user uploaded image, I have learnt that several approaches exist to achieve this goal. I think this is currently the conversational way of getting the file extension:
$ext =…

sakhimpungose
- 13
- 4
0
votes
0 answers
Setting cookies with $_SERVER info
I'm trying to set a cookie which tracks what page the user is on, so that I can forward this in a websocket header, however when I do this:
setcookie("PAGE", $_SERVER['PATH_INFO'], 0, "/");
Which should be setting a cookie to something like…

Josh Cropper
- 1
- 1
0
votes
0 answers
PHP upload image file issue
I am currently working on a site, of which needs to have it be possible for users to upload an image file. I have the HTML form setup and it seems to be working, this isn't the part with the issue. The issue is the PHP part, where I am getting the…

DevLiv
- 573
- 7
- 19
0
votes
2 answers
Apache with PHP serves a base file instead of 404
Problem: Suppose a URL is requesting a file that doesn't exist, e.g. mydomain.com/index.php/bogus
There is no folder named 'bogus' so I expect a '404 not found' response, but instead Apache sends the request to /index.php (which does exist). Why?…

Barry Hansen
- 11
- 4