@@ -40,12 +40,15 @@ public function store(Request $request)
4040 $ file_type = $ request ->input ('file_type ' );
4141 $ file_data = $ request ->input ('file_data ' );
4242
43+ $ relative_directory = $ request ->input ('directory ' ) ?? null ;
44+ $ public = $ request ->input ('public ' ) ?? false ;
45+
4346 //this is set up with two distinct routes so that the FileUploader component can still call the `store / post` method on the file object
4447 //in the cloud route, we are doing a direct upload to s3
4548 //in the other route, we are doing a an upload to the server, then to s3
4649 if (!$ file_data )
4750 {
48- $ data = File::s3CreateUpload (new File , $ file_name , $ file_type );
51+ $ data = File::s3CreateUpload (new File , $ file_name , $ file_type, $ relative_directory , $ public );
4952 $ file = $ data ['file ' ];
5053 $ upload_url = $ data ['upload_url ' ];
5154
@@ -61,7 +64,7 @@ public function store(Request $request)
6164 }
6265 else
6366 {
64- $ file = File::uploadAndCreateFileFromDataURI ($ file_name , $ file_type , $ file_data );
67+ $ file = File::uploadAndCreateFileFromDataURI ($ file_name , $ file_type , $ file_data, $ relative_directory , $ public );
6568 $ file ->refresh ();
6669
6770 return response ()->json ([
@@ -104,12 +107,15 @@ public function update(Request $request, File $file)
104107 $ file_type = $ request ->input ('file_type ' );
105108 $ file_data = $ request ->input ('file_data ' );
106109
110+ $ relative_directory = $ request ->input ('directory ' ) ?? null ;
111+ $ public = $ request ->input ('public ' ) ?? false ;
112+
107113 //this is set up with two distinct routes so that the FileUploader component can still call the `update / put` method on the file object
108114 //in the cloud route, we are doing a direct upload to s3
109115 //in the other route, we are doing a an upload to the server, then to s3
110116 if (!$ file_data )
111117 {
112- $ data = File::s3CreateUpload ($ file , $ file_name , $ file_type );
118+ $ data = File::s3CreateUpload ($ file , $ file_name , $ file_type, $ relative_directory , $ public );
113119 $ file = $ data ['file ' ];
114120 $ upload_url = $ data ['upload_url ' ];
115121
@@ -125,7 +131,7 @@ public function update(Request $request, File $file)
125131 }
126132 else
127133 {
128- $ uploadedFile = File::makeUploadFileFromDataURI ($ file_name , $ file_type , $ file_data );
134+ $ uploadedFile = File::makeUploadFileFromDataURI ($ file_name , $ file_type , $ file_data, $ relative_directory , $ public );
129135 $ upload_location = File::upload ($ uploadedFile , null , true );
130136
131137 $ file ->file_name = $ file_name ;
0 commit comments