Solved

How do get the filename string?

Posted on 2011-03-20
2
269 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
  • 2
2 Comments
 
LVL 109

Accepted Solution

by:
Ray Paseur earned 500 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 109

Expert Comment

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

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Learn by example how to specify CSS selectors for Selenium WebDriver test automation software.
An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

770 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