Hello, I am trying to upload image files along with some text inputs (email) from an HTML form. File Upload will happen successfully if I remove “$email=$request->post(‘email’);”
I want email because by using email as the primary key I try to insert image path url in DB. Is there any simple way store Url after storing file using “moveUploadedFile()” method??
Here is my code:
`function moveUploadedFile($directory, UploadedFile $uploadedFile)
$extension = pathinfo($uploadedFile->getClientFilename(), PATHINFO_EXTENSION);
$basename = bin2hex(random_bytes(8)); // see http://php.net/manual/en/function.random-bytes.php
$filename = sprintf(’%s.%0.8s’, $basename, $extension);
$uploadedFile->moveTo($directory . DIRECTORY_SEPARATOR . $filename);
/*$filepath = $directory . DIRECTORY_SEPARATOR . $filename;
case 1: $colname= “user_photo_url”;
case 2: $colname= “ar_img_url”;
case 3: $colname= “pan_img_url”;
case 4: $colname= “passport_img_url”;
$result_url = DbHandler:: storeurltoDB($email, $filepath, $colname);*/
// return $filename." And File URl path ::".$result_url;
In the above method, I removed $email as part of the argument because it is giving the error. I will pass that later on. Assuming I passed arguements.