1

I'm trying to upload a file to a location but it create always a folder with the file name and put the file inside this folder.

For exemple: If we add a file name xpto.pdf it put the file into /location/xpto.pdf/xpto.pdf and i don't understand why it happens.

$directory = "\\SRVGDOC\GDOC\CSdefault21\group1\";
$fname = pathinfo(Input::file('file')->getClientOriginalName(), PATHINFO_FILENAME);
$fext = Input::file('file')->getClientOriginalExtension();
$fullname = $directory . $fname . '.' . $fext;
// $fullname = \\SRVGDOC\GDOC\CSdefault21\group1\xpto.pdf

Input::file('file')->move($fullname, $fname.'.'.$fext);

What can be the problem?

Thank you

4
  • did you notice.. $fullname = $directory . $fname . '.' . $fext; and then ->move($fullname, $fname.'.'.$fext);? Commented May 16, 2017 at 9:46
  • $fullname = $directory . $fname ; Commented May 16, 2017 at 9:53
  • So, i have just to put $fullname = $directory and then move($fullname, $fname. '.'.$fext); @BagusTesa Commented May 16, 2017 at 10:07
  • why without $fext @BilalAhmed Commented May 16, 2017 at 10:09

1 Answer 1

1

The move method requires the path (directory name) and the filename.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.