Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How do get the filename string?

Posted on 2011-03-20
2
Medium Priority
?
274 Views
Last Modified: 2012-05-11
Hey Guys, how can I get the string of the filename from the following:

$pathinfo = pathinfo($this->file->getName());
$filename = $pathinfo['filename'];

Open in new window


When I hardcode the the filename my exec () function works perfectly but $filename doesn't appear to be a string?

exec('convert /var/www/valums/server/uploads/files/MIPS.pdf[0] /var/www/valums/server/uploads/preview/' . $filename . '.jpg');

Open in new window


Thanks in advance.
0
Comment
Question by:the_con
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 2000 total points
ID: 35177273
Use var_dump() to print out the contents of $filename.   You will be able to see the data type.  If you need to cast it as a string, you might do something like this:

$pathinfo = pathinfo($this->file->getName());
$filename = (string)$pathinfo['filename'];
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 35183258
Thanks for the points - it's a great question, ~Ray
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question