Get text from file name, is that possible?

shiloz22

Новичок
Регистрация
03.12.2012
Сообщения
21
Благодарностей
0
Баллы
0
Hi, i have a template that uploads a random image from a folder to a website, but i need a Title to fill in for each post, is it possible to get the filename and use that as text to fill in?


So if i upload file named "Funny picture.jpg" i want to get the text "Funny picture" to use as the title to post, this way i dont need to make lists for titles for each image.


If anyone knows how to solve this or knows a easier way for me to solve this please respond, willing to pay.
 

lokiys

Moderator
Регистрация
01.02.2012
Сообщения
4 812
Благодарностей
1 187
Баллы
113
Just take random picture from your folder and you will get like C:\zenno\Pictures\Funny Pictures.jpg

In this case if your folder name is Pictures you can use Regex to get Pic name...
(?<=Pictures\\).*?(?=\.jpg)
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)