简体   繁体   中英

Laravel 4.2 strange routing issue

Basically, I tried to upload a file and after the app created a folder inside public, every action routed me to localhost/videos. Then whenever I delete the folder it created, the behavior reverts to normal. How can creating a folder inside public which isn't even in the app folder mess up the routing? I am using Laravel 4.2 and PHP 5.5.10.

This is what I did:

$filename = date('Y-m-d-H:i:s')."-".$client_file_name;
$destinationPath = base_path() . '\public\uploaded_video';
Input::file('post')->move($destinationPath, $filename);

the second line messes up the routing and then everything becomes back to normal when I delete the folder. Is it because I am running on Windows or something? I tried doing '/public/uploaded_video' instead, but I think it didn't work.

Actually any_Path function returns the local path on the server but you need a url so in this case, you may try something like this:

$destinationPath = asset('uploaded_video');

More on Laravel website .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM