Category : c#

Here is my Laravel code that accept file and save it to folder, this code is simplified. public function store1(Request $request) { $validator = Validator::make($request->all(), [‘file’ => ‘required|mimes:doc,docx,pdf,txt,mdb’, ]); if ($validator->fails()) { return response()->json([‘error’=>$validator->errors()], 401); } if ($files = $request->file(‘file’)) { $file = $request->file->store(‘public/documents’); return response(‘ok’); } } And Here is My C# Code private ..

Read more

I converted this method from C# to Laravel: C# code: using (SHA1Managed sha1 = new SHA1Managed()) { var hash = sha1.ComputeHash(Encoding.UTF8.GetBytes(input)); var sb = new StringBuilder(hash.Length * 2); foreach (byte b in hash) sb.Append(b.ToString(“X2”)); return sb.ToString(); } and in laravel: $text = hash(‘sha1’, $txt); $byte_array = unpack(‘C*’, $text); foreach ($byte_array as $b) $r .= chr($b); ..

Read more