Kenneth Posted June 29, 2020 Share Posted June 29, 2020 Всем привет. Столкнулся с такой проблемой, если в TUnimImage.Url указываю относительный путь к файлу, который находиться в той же папке или во вложенной, то проблем нет. Но если файл находится в папке выше, то изображение не загружается. Например вот такой путь '../files/img/27.jpg'. Вопрос: как указать относительный путь к файлу, находящийся в папке выше текущей? Link to comment Share on other sites More sharing options...
Kenneth Posted June 29, 2020 Author Share Posted June 29, 2020 есть идея? Link to comment Share on other sites More sharing options...
stas Posted June 29, 2020 Share Posted June 29, 2020 Что говорит лог консоли? Link to comment Share on other sites More sharing options...
Kenneth Posted June 29, 2020 Author Share Posted June 29, 2020 В консоле следующая ошибка, когда я указываю путь '../files/img/27.jpg': GET http://localhost:8077/files/img/27.jpg 404 (Not Found) Получается он отталкивается от текущего каталога и нет возможности указать каталог выше? Link to comment Share on other sites More sharing options...
Sherzod Posted June 30, 2020 Share Posted June 30, 2020 9 hours ago, Kenneth said: Получается он отталкивается от текущего каталога и нет возможности указать каталог выше? Здравствуйте, Относительные пути определяются от корневого каталога вэб-сервера, как каталога самого высокого уровня. Link to comment Share on other sites More sharing options...
Kenneth Posted June 30, 2020 Author Share Posted June 30, 2020 Вопрос решен. Для таких случаев необходимо использовать : UnimImage1.Picture.LoadFromFile('../files/img/27.jpg'); Link to comment Share on other sites More sharing options...
Kenneth Posted June 30, 2020 Author Share Posted June 30, 2020 Спасибо @Sherzod уже разобрался. Link to comment Share on other sites More sharing options...
stas Posted June 30, 2020 Share Posted June 30, 2020 7 hours ago, Kenneth said: UnimImage1.Picture.LoadFromFile('../files/img/27.jpg'); В этом случае сгенерируется новый файл в кеше Link to comment Share on other sites More sharing options...
Kenneth Posted June 30, 2020 Author Share Posted June 30, 2020 @stas можете просветите, это плохо? И если да, то что можете предложить? Link to comment Share on other sites More sharing options...
stas Posted July 1, 2020 Share Posted July 1, 2020 Нет, не плохо. Просто разные способы загрузки 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now