-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #164 from IFRCGo/feature/WN-146
WN-146
- Loading branch information
Showing
14 changed files
with
1,039 additions
and
351 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use App\Classes\RcnApi\RcnApiClient; | ||
use Illuminate\Http\Request; | ||
|
||
class FileController extends Controller | ||
{ | ||
protected $rcnApiClient; | ||
|
||
public function __construct(RcnApiClient $rcnApiClient) | ||
{ | ||
$this->rcnApiClient = $rcnApiClient; | ||
} | ||
|
||
public function uploadFile(Request $request) | ||
{ | ||
$request->validate([ | ||
'file' => 'required|file' | ||
]); | ||
|
||
$file = $request->file('file'); | ||
$filePath = $file->getPathname(); | ||
$fileName = $file->getClientOriginalName(); | ||
|
||
try { | ||
$response = $this->rcnApiClient->whatnow()->uploadFile($filePath, $fileName); | ||
return response()->json($response); | ||
} catch (\Exception $e) { | ||
return response()->json(['error' => 'File upload failed'], 500); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.