Solved

How do get the filename string?

Posted on 2011-03-20
2
272 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 110

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 110

Expert Comment

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

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

728 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