Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
205 views
in Technique[技术] by (71.8m points)

php - Trying to upload word, pdf and plain text file to laravel (and download them again)

I guys, I'm facing a brick wall with my code right now. I'm trying to upload "CV" to website but it won't "Save" Anything but pdfs. My controller looks something like this, which is what i think the problem is coming from.

public function getDownloadCV($email, $name)
 {
  //PDF file is stored under project/public/download/info.pdf
  $file = storage_path() . "/app/cv/" . $email . "/" . $name . "";
//   dd($file);
  $headers = array(
    'Content-Type: application/pdf', 'Content-Type: application/msword', 'Content-Type: text/files',
  );

    return response()->download($file, 'cv-' . $email . $headers);
 }
question from:https://stackoverflow.com/questions/65915870/trying-to-upload-word-pdf-and-plain-text-file-to-laravel-and-download-them-aga

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...