Kenneth Posted June 29, 2020 Share Posted June 29, 2020 Всем привет. Столкнулся с такой проблемой, если в TUnimImage.Url указываю относительный путь к файлу, который находиться в той же папке или во вложенной, то проблем нет. Но если файл находится в папке выше, то изображение не загружается. Например вот такой путь '../files/img/27.jpg'. Вопрос: как указать относительный путь к файлу, находящийся в папке выше текущей? Quote Link to comment Share on other sites More sharing options...
Kenneth Posted June 29, 2020 Author Share Posted June 29, 2020 есть идея? Quote Link to comment Share on other sites More sharing options...
stas Posted June 29, 2020 Share Posted June 29, 2020 Что говорит лог консоли? Quote 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) Получается он отталкивается от текущего каталога и нет возможности указать каталог выше? Quote 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: Получается он отталкивается от текущего каталога и нет возможности указать каталог выше? Здравствуйте, Относительные пути определяются от корневого каталога вэб-сервера, как каталога самого высокого уровня. Quote 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'); Quote Link to comment Share on other sites More sharing options...
Kenneth Posted June 30, 2020 Author Share Posted June 30, 2020 Спасибо @Sherzod уже разобрался. Quote 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'); В этом случае сгенерируется новый файл в кеше Quote Link to comment Share on other sites More sharing options...
Kenneth Posted June 30, 2020 Author Share Posted June 30, 2020 @stas можете просветите, это плохо? И если да, то что можете предложить? Quote Link to comment Share on other sites More sharing options...
stas Posted July 1, 2020 Share Posted July 1, 2020 Нет, не плохо. Просто разные способы загрузки 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.