PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Sun May 31, 2020 1:36 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Thu Oct 08, 2015 10:11 am 
Offline
Forum Contributor
User avatar

Joined: Wed May 14, 2014 12:18 pm
Posts: 331
I am using the IMAGINE package in laravel , I have the below line in laravel:

Syntax: [ Download ] [ Hide ]
$path = public_path('img\testsave\/' .$filename);
 


now I'm getting the following error:

Syntax: [ Download ] [ Hide ]
C:\xampp\htdocs\lookinggood\public/img\testsave/2015-10-07-11-40-19-edit-one.jpgjpg does not exist.
 


Syntax: [ Download ] [ Hide ]
The backslash after public needs to be changed to a forward slash. After testsave I am getting the \/ .
 


I have tried to escape the forward slash like so:

Syntax: [ Download ] [ Hide ]
$path = public_path('img\testsave\/' .$filename);
 


So how do I change the backslash after public to a forwardslash and how do I successfully escape the forward slash after testsave ?


Top
 Profile  
 
PostPosted: Thu Oct 08, 2015 9:36 pm 
Offline
Site Administrator
User avatar

Joined: Wed Aug 25, 2004 7:54 pm
Posts: 13592
Location: New York, NY, US
I think you should use only forward slashes. PHP makes them work on windows. If you mix them it gets confused.

_________________
(#10850)


Top
 Profile  
 
PostPosted: Fri Oct 09, 2015 4:54 am 
Offline
Forum Contributor
User avatar

Joined: Wed May 14, 2014 12:18 pm
Posts: 331
even if i change my code to the below ,

Syntax: [ Download ] [ Hide ]
 $path = public_path("img/testsave/" .$filename);


I still get an error as follows:



Top
 Profile  
 
PostPosted: Fri Oct 09, 2015 4:58 am 
Offline
Forum Contributor
User avatar

Joined: Wed May 14, 2014 12:18 pm
Posts: 331
i know that windows does't really bother weather its a forward or a backslash.


Top
 Profile  
 
PostPosted: Fri Oct 09, 2015 6:14 am 
Offline
Moderator
User avatar

Joined: Tue Nov 09, 2010 3:39 pm
Posts: 6425
Location: Montreal, Canada
What's the other code surrounding that? Have you check that the file does in fact exist?

_________________


Top
 Profile  
 
PostPosted: Fri Oct 09, 2015 8:36 am 
Offline
Forum Contributor
User avatar

Joined: Wed May 14, 2014 12:18 pm
Posts: 331


Top
 Profile  
 
PostPosted: Fri Oct 09, 2015 4:07 pm 
Offline
Site Administrator
User avatar

Joined: Wed Aug 25, 2004 7:54 pm
Posts: 13592
Location: New York, NY, US
Have you tried:
Syntax: [ Download ] [ Hide ]
             $path = public_path("img\\testsave\\" . $filename);
 

_________________
(#10850)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group