I am uploading a file and saving it in local storage. These files are stored in the database related to a particular user. When i return the last saved user. I get other details in response properly. But instead of the file path. I get the file as response
$file = $request->file('resume');
$profile_id = $request['profile_id'];
$original_name = $_FILES['resume']['name'];
$resume_new_name = str_random(). '.' . $file->getClientOriginalExtension();
$new_file = $request->file('resume')->move('resources/assets/resumes',$resume_new_name);
$candidate_info['resume'] = $new_file;
$candidate = new candidate();
if (empty($candidate_info['name'])) {
$candidate_info['name'] = $candidate_info['email'];
}
$candidate->name = $candidate_info['name'];
$candidate->phone = $candidate_info['phone'];
$candidate->email = $candidate_info['email'];
$candidate->resume = $candidate_info['resume'];
$candidate->client_id = \Auth::user()->id;
$candidate->status = "new";
$candidate->profile_id = $profile_id;
$candidate->save();
return response()->json(['msg' => $candidate]);
In database column 'resume' it stores the path. But in json response it sends the whole file instead of the path. how do i send the path instead of sending the whole file
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2kcGyyg
via IFTTT
Aucun commentaire:
Enregistrer un commentaire