Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How do get the filename string?

Posted on 2011-03-20
2
Medium Priority
?
281 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 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
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.
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses
Course of the Month10 days, 16 hours left to enroll

885 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