Net core upload image. Step 7. Dec 13, 2019 · Probably you might have missed the format of image while saving, and file name should be complete (not folder path) pic. first I edited config. Mar 26, 2022 · Next inside the service make sure to have your access key, access secret, and bucket name accessible. Sep 20, 2022 · Open Visual Studio and create a new project, choose ASP. NET currently only supports Windows. editorConfig = function (config) {. In my Web API, I can successfully upload the image via API call; it uses ( [FromForm]) in the request of POST Image, however when I'm trying to make a call using the web app, I can see the request doesn't pass the parameters to the API call. Mar 1, 2024 · For more information, see Upload files in ASP. like below: We read the image file from the server, convert it to a base64 string, and then construct the image URL using the data:image/png;base64 format. NET Core Environment Variables and Configurations; Exception Handling In ASP. Before. Here's the model. Below are the code details. com/channe Nov 28, 2023 · To Configure The File Upload Service in ASP. cs file as below: and modify the Create. NET Core -> ASP. NET Core New You could implement an action with POST http verb to that receive a collection of HttpPostedFileBase and save all files, for sample: [HttpPost] public ActionResult Upload(IEnumerable<HttpPostedFileBase> files) { foreach (var file in files) { file. The ImageWriter is a . Visual Studio 2019 16. As discussed earlier, we will start with creating S3 Buckets via the console. cshtml. When the application is run, n instances of the clients can be opened. jpg") }; var uploadResult = cloudinary. Uri. net C#: Download and include the jQuery lib file. My client model file looks like this: public partial class Klienti. png, image2. microsoft. Ajax based implementation and form based implementation. NET. Conclusion. In the next screen, enter the following details and click on the Next button. This folder will be used to store all uploaded files. 4. May 4, 2021 · How to upload an image with ASP. in CustomConfig. Wait until the project is loaded, then delete the template endpoint WeatherForecastController along with WeatherForecast Sep 15, 2021 · Step to Upload image using jQuery in Asp. So far, when uploading an image, it gets added to my desired folder with a specific name. Give your project a name like ‘FileUploadApi’ , and then press next: Keep all settings as default with . FileName)); } return View(); } Dec 13, 2023 · Use the 'POST' handler method and implement the Chunk Upload technique. Uploading and displaying images in ASP. Install AWSSDK. Start Visual Studio and select Create a new project in the Create a new project dialog. The front-end/UI part of the file upload will be handled using Vue. 0? Jan 19, 2017 · Magick. FormFiles" type = "file" multiple >. async (HttpRequest request) =>. Nov 7, 2018 · Create an array to hold the files 2. FileName, file. Forms can also be used to upload files. To upload file in asp. Add the multiple attribute to permit the user to upload multiple files at once. net core api, because I want to save it in SQL database. GetFileName(pathName); to remove paths from the filename, string myEncodedString = HttpUtility. But unfortunately it does not work : Feb 19, 2024 · 0. In any case, I managed to get the base 64 image from this plug-in into a variable using this java script: Jul 19, 2019 · In this post we will be discussing about creating an application where you can upload image from angular 8 to ASP. Jan 27, 2022 · I am trying to upload files from a website to my wwwroot/images directory but sometimes only half the image get uploaded and it doesnt seem to work with . NET Core is a common requirement in web development. In the Project Template box, select Web Application (Model-View-Controller) options and click on the OK button. NET Core File Upload is one of the many UI components in the suite with out-of-the-box support for keyboard navigation. When needing more complex features like controlling the quality, rotating images, and more, check out the amazing ImageSharp package. In the index page, able to list the employees and see their images as well. Step 11. 8 or later with the ASP. In this we will be going through Back End first i. ProductSave(productCommonDto); return Json(result); Model. NET Core, a professional grade UI library with 110+ components for building modern and feature-rich applications. Also, for uploading multiple files, we use Postman. Join this channel to get access to perks:https://www. The single file will be buffered in memory using IFormFile and the file content will be accessible as the stream. NET wrapper for the popular ImageMagick library. Feb 3, 2024 · Create a Simple ASP. But with the Razor Mar 16, 2022 · Just noting here, you can upload a file with any ContentType like the following sample code. Make sure that the target framework selected as . AddControllers(); // Add services for IFormFile. This is what I'm trying to achieve. . Earn 10 reputation (not counting the association bonus) in order to answer this question. "AppSettings": {. Sep 2, 2016 · Somehow I managed to send file to asp. This includes registering the services that handle file uploads. NET Core Web Application, give a name and hit OK. string uploadedFileId; // Create a new file on Google Drive. NET Core to upload person image, I put an HTML Image element beside the Upload image tool to display the image after upload it. Update the class with following code. This tutorial assumes that, you already have a valid ASP. Get answers from experts and other developers on Stack Overflow. NET Core are server-side wrappers for the Kendo UI Upload widget. Empty; Jun 16, 2012 · Learn how to check if an uploaded file is an image in any format using MVC. This tutorial teaches ASP. Upload(uploadParams); For Stream: File = new FileDescription(file. Highly active question. CustomConfig. S3 package using the Nuget Package Manager. 1. jpg file without saving it to the local machine (not allowed in a deployed Lambda function) I get the file in hex-string form and can re-code it into binary, save it as a file, and even upload it from my local debug normally. Zahid’s Substack is a reader-supported publication. I wanted to add an image as part of the model class and display it on the index view. This all works well, however we are having performance issues while uploading the image. NET Core 3. – log234. Handle the form submission as ajax request with the array of files. Its using Jquery Ajax call to upload model data + file. The reputation requirement helps protect this question from spam and non-answer activity. InputStream), This second method allows you to even post a byte [] image content or a Base64 Apr 27, 2022 · But, I want to upload bytes[] to blob storage. Users can easily navigate the component using a combination of keyboard buttons to focus the desired file and reset, cancel or pause its upload. NET Core API 2. Save(DefaultImagePath+fileName. 0 Tutorial Articles. Does anybody have suggestion how this can work ? HTML Basically, Cloudinary allows you to upload files from Paths or from Streams. Dec 29, 2016 · How can I upload a list of files (images) and json data to ASP. Feb 10, 2020 · Controller. How to achieve this? Both web API and web Application are created in Dot net core 2. The fields in formdata should be corresponding to the model fields. Here is my code: public bool UploadFile(string base64String) { Sep 13, 2021 · I used upload tool for ASP. 0 SDK or later. Net Core WebAPI. png files, here is my code: [HttpPost] Aug 27, 2021 · Yes you can upload a file to the file system in a www/root folder, and return the file path. NET Version: 6. NET Core Web API. The . Net Core: In any web application uploading file is a very common feature. Server-side - Add Generic Handler (ashx file) to handle server-side code, i. HomeController manages the request and the upload action. 0 Preview for . First of all, we build a Jan 20, 2022 · Select . 2. } Client Code: async sendImage(event) {. File. Source: learn. I did two things to solve my problem. So here in this article, we are going to learn how using IFormFile we can upload files in Asp. net core mvc with helpful answers and examples from Stack Overflow community. png. Step 2. Name parameter value. "); Firstly, we validate if the file is not empty. In our web API, we implement the following API method: 1. public async Task<ServiceResult<ImageDto>> UploadImageToS3(AddImageCommand command) {. NET Web API . Show (display) Progress Bar while image uploading. Name this application as Core_API_ImageUploader. The following example demonstrates the use of a Razor Pages form to upload a single file. Asp. NET code. NET Core; Simple CRUD Operation With Asp. The task is to Upload file with form data Problem: Form data is null. Finally we will call upload async to upload the file to google drive. net core web api to Amazon Web Services (AWS) using S3 bucket. Depending on the client Framework you're using, you can configure your Web API for Content Type-Multipart, then do something like: Jul 22, 2022 · I want to upload an image in a post method for edit a record,this is the form that send the data to the controller: <form asp-action="Edit"> <div asp-validation-summary=" May 21, 2019 · 6. NET Core Upload component is part of Telerik UI for ASP. The next action is to send a post request and pay attention to it. Now, we are going to upload a single file using swagger by providing the file and type of file based on the enum id. NET 5 is Released but with Breaking Changes; ASP. public IActionResult ProductSave(ProductCommonDto productCommonDto) var result = _productProcessService. NET Core) but i dont know how to store it in a file it is just uploaded on the server this is the html : Mar 17, 2019 · You need to use formdata with FromForm. 1 class library project which takes care of writing and the image to the disk. NET Core 2. On the file change event of your input push the file to the array 3. Step 1. Finally, we run the application. This tutorial will show you how to create an image, photo, or file upload interface using ASP. Just use IFormFile as a parameter of your action or a collection of files or IFormFileCollection if you want upload few files in the same time: Sep 28, 2020 · Upload Image in React with Asp. May 4, 2013 · finally I could find the solution. Png); Aug 2, 2020 · To explain, I am using a 3rd party plugin for uploading images called slim cropper. Png); rewrite like. The form must have an enctype attribute set to multipart Dec 25, 2019 · Basically what I would like to do is select image from local machine then on button click to send it to azure blobs using a post method then retrieve and display the image on the web page using a get method. ImageMagick is an open-source, cross-platform library that focuses on image quality, and on offering a very wide choice of supported image formats. First. Angular. The Upload is part of Telerik UI for ASP. Add(user); await _context. [NotMapped] public IFormFile Image { get; set; } And then use [FromForm] attribute in your request. NET Core MVC View which uses a multiple file input HTML control. Now a blank project solution is ready. NET Framework. You will learn to upload, edit, and delete image files with Dapper, repository pattern, and UnitOfWork in . MVC ASP. The Telerik UI for ASP. For File Path: File = new FileDescription(@"c:\sample. – Zoilo Reyes. AbsoluteUri; } Apr 14, 2022 · Upload file using jQuery ajax in Asp. How do I enable image uploads in the self-hosted version of Tinymce for Classic ASP? Hot Network Questions Aug 5, 2021 · Step 1: Open Visual Studio and create a new ASP. 1 also without using form tag, by just making an ajax post request on file selection i. cs is the default controller used to define the upload action. I am unable to use 3rd libraries as Axios (at least I dont know how) , but pure Jquery. Here you can see we use an array index to send the file and their type, and it will be working fine. Foe that, I will pass only byte[] array, and it should upload. Create)) {. Search for S3 in the top search bar and open up the first result. Aug 9, 2022 · Set the folder directory path to store the image. May 9, 2017 · This is the method to upload files to Amazon S3: private IHostingEnvironment _hostingEnvironment; private AmazonS3Client _s3Client = new AmazonS3Client(RegionEndpoint. Name the images image1. public IFormFile FormFile { get; set; } } 3. cshtml May 13, 2021 · To upload the image file into database via Asp. The upload API method returns a response structure FileUploadResponse as shown: Apr 2, 2022 · With the user created, Let’s explore a bit of the AWS S3 Console. Step 5. pic. Our Project will look like this: Now we Nov 26, 2020 · We will also send an additional field to server while uploading a file. youtube. The Image parameter should be IFormFile type. In this example HomeController. NET Core Web Application > Next. For a files input element to support uploading multiple files provide the multiple attribute on the <input> element: < input asp-for = "FileUpload. Add Html Markup file input tag. Register. NET Core Web API; ASP. You could do some sort of recursive algorithm where you incrementally lower the quality from max until the file size is within an acceptable range, but it could potentially take multiple recursions and depending on the uploaded file size, might cause Apr 3, 2021 · and pass it the file metadata, and the filestream itself. Feb 10, 2024 · This is how we can perform file name extension validation in the controller: return BadRequest("Invalid file type. CopyToAsync(stream); } . e. It also has the same support for EXIF as ImageSharp. Net Core Web API file is always null but to do so I had to create another action that has no parameters, but how to send file in my situation is still unknown Mar 5, 2024 · The following example demonstrates how to dynamically set an image's source with a C# field. Net Core and Angular - Part 1; Build a Simple ASP. First, we create a class in the model folder. Read the directory path with key "AppSettings:ImageDir" from IConfiguration. And I have object type of File. Feb 21, 2019 · I have a web API which takes image as input and saves the photo in some directory. Jun 8, 2020 · In this article, let's go through one of the most searched queries on Google, "File Upload in ASP. Assuming you want to upload files then you'll submit the form with the uploaded files. 1. Add the token value to the file uploader's requests because ASP. ServiceResult<ImageDto> imageDto; Sep 11, 2022 · upload image and show that in asp. Uploading Images or other documents is a very basic and common requirement when it comes to building anything from a simple application to an enterprise-level solution. I have both an ASP. Jun 23, 2021 · Implementation of a File Upload Web API Methods. net core mvc using IFormFile. ascx file and set the base url to images folder. For the most part, you will use forms to capture data from the user as simple string, numeric, datetime or boolean values. NET Core Upload Keyboard Navigation demo. NET Core part and then we will go through the frontend i. May 20, 2024 · To upload small files, use a multipart form or construct a POST request using JavaScript. Image is not available anymore, I couldn't find a way to convert the iFormFile into an Image typed object, to check the width and height to calculate the aspect ratio of it. NET Core Web API controller using multipart upload? I can successfully receive a list of files, uploaded with multipart/form-data content type like that: public async Task<IActionResult> Upload(IList<IFormFile> files) Jan 31, 2024 · The first one is to hold the message when the upload action is finished and the second one is to show the upload progress. You can implement two different way of file upload to MVC projects. I'm having problems either classifying the image as a byte [] or iFormFile. Select ASP. removeDialogTabs = 'image:advanced;image:Link;link:advanced;link:upload'; Jun 14, 2019 · Now just add [AllowedFileExtensions] to your Controller's method signature directly or Model: public async Task<IActionResult> AddPhoto([AllowedFileExtensions] IFormFile file) { } Here is the output if a non-allowed file is selected: {. Let's build a small application with which you could upload files of any type to a file system location or to a Jan 16, 2019 · Had same problem with dot net core, here's what I did:-Make virtual directory -Map it to that folder path (inside wwwroot)-Make your fullpath equals to this VD ; absolute path (can keep it in config file)-Give write permissions for this folder to iisuser Oct 4, 2020 · This Image class is just a class for uploading, that will contain the path of the image, the id, the description and a NotMapped IFormFile property to do the upload. For the example in this section: Obtain three images from any source or right-click each of the following images to save them locally. import Since System. NET OData 8. Fully working example with (. NET 6 as the framework then choose Create. json. By default, the user selects single files. Then, give a unique name for your bucket, choose Standard for Storage class, choose a suitable Nov 6, 2016 · 3. We write the image in wwwroot/images folder which I have Jun 19, 2022 · I'm working on a feature to add images to the database. So far I can upload image in react but when I send the image to the server I get null. For configurable purposes, add the setting for the folder directory path used to store the image in appsettings. Use the InputFile component to read browser file data into . NET Core 5 API application. NET Core 5. NET Core and i am trying to make a POST request to the "Imgbb API" and upload a picture and get the upload link in response, (because imgbb seems simpler to me than imgur that requires authorization and other things, so I chose imgbb) so far this is what i have: Apr 10, 2022 · 2. net Core 3. You could try to follow steps below : 1. The uploads directory is created automatically if it does not exist under wwwroot/upload/. NET and web development workload. May 31, 2022 · You should receive the Image as IFormFile property in your Machine class. I would recommend saving those in . This tutorial requires that you have a basic knowledge of Microsoft SQL Server and Microsoft SQL Server Management Studio. 1 I just started working on ASP. Read)) {. Then, copy the IFormFile to a stream and save it as a byte array in the database. Step 8. The file will be uploaded to a folder that is unique to the user. Jun 22, 2021 · As shown in the post, uploading and resizing images in ASP. Next, we are checking if the file name extension is one of the following: pdf, doc, docx. NET Core Web API using ASP. net core tutorial: How to upload file (image) in asp. cshtml page like this: You can view the source code from here: 192030-file-create. Step 6. How can I do ? public static async Task<string> UploadFileToBlobStorage(byte[] array) { return blob. To do this I adding image via: <input type="file" accept="image/png, image/jpeg">. {. Environment: ASP. To receive new posts and support my work, consider becoming a free or paid subscriber. [HttpPost] public async Task<ActionResult<Machine>> Create([FromForm] Machine machine) Now you can remove these lines. net COre and i would like to upload a file ( an image) and store it in a secific Folder. Uploading image to database in . using (Image pic = Image. If i Aug 26, 2022 · You can take 2 parameters. In the next screen, configure other details or leave them as default and click on the create button. Open, FileAccess. public int Id { get; set; } public string CarName { get; set; } public string ImagePath { get; set; } public string CarName { get; set; } public IFormFile Image { get; set; } Dec 16, 2019 · 2. This script looks for a specified input tag (in this case ImageFile) and creates an interface for users to upload pictures. , C# code to saving the uploaded file. using (MemoryStream ms = new MemoryStream(bytes)) {. How can I get the width and height of an image with the type iFormFile in ASP. Install . Save(DefaultImagePath,ImageFormat. I'm new to ASP. Step 2: In this project, add a new folder and name this folder as Files. public ProductDto Product { get; set; } public IFormFile ProductImage { get; set; } The problem is, when I trying to upload image it returning ( Null ) in backend. Net Core). 1 MVC. Click Create Bucketon the next screen. As it is take a lot of time to upload. png, and image3. In the Configure your new project dialog, enter Nov 6, 2017 · i am new to ASP. Config file and store the connections string to this file which we already copied from the Azure portal. NET 5. net's Secret Manager, but you can also save them in some Config files. js and the logical file saving part/back-end will be handled using ASP. services. net core mvc. In the uploadFile function, we create a formData object and append the file that we want to upload. First, open the App. Model. Step 12. net core API, first, we should use IFormFile to send the image file from the client to the API action method. This sends the files to the MVC Controller as a multipart/form-data request. NET Core Web Application project. NET Core can be achieved with just a few lines of code. Aug 15, 2018 · The Handler folder has a ImageHandler. SaveAs(Server. We are uploading images from . FromStream(ms)) {. config. Place the images in a new folder named images in the app's web Jun 28, 2019 · I'm using AWS Lambda C# . May 13, 2018 · The images are uploaded using an ASP. I invoke . public Klienti() Apr 24, 2015 · MVC 6 used another mechanism to upload files. Add a new folder to the project and call it wwwroot , and create images folder and Cars subfolder in wwwroot folder. Nov 21, 2020 · Step 1. Finally, we pass the image URL to the view for rendering. Check out the ASP. You could refer the following sample, in this sample, I use two View models to let user enter values and In order to support file uploads, HTML forms must specify an encoding type ( enctype) of multipart/form-data. We select . This simple illustration demonstrates how this can be achieved by uploading the file to the file server and return the file's URL. I found this tutorial for API which says that my property in backend should looks: public byte[] ImageData { get; set; } Jan 8, 2021 · Uploading Files in Razor Pages. Success event for upload tool and used a javascript function to set the src attribute for the image element with the uploaded image path. Some portion of the answer adopted from the above answers with fixing the compilation errors. Create Controller with name AwsS3Controller. await using (var fsSource = new FileStream(UploadFileName, FileMode. NET 5 and security is None. This will cover basic scenarios. js add this codes: CKEDITOR. And use var filePath = Path. ASP. Then one can be used to upload images to all the other SignalR clients. For the chunk or Ajax upload, make sure that the first parameter in your handler equals the FileUploader. However, when checking the users I can see that the imageFile column is null. Create an image for the uploaded image and an event handler to delete the image from the array. Step 4. Web API code: Dec 9, 2019 · 1) You cannot do any operation on the image before it's uploaded, at least with C#. (on input change event). In the later part, we will see how to create and delete S3 buckets via . In this example I chose a text/plain ContentType, but you can choose your own by editing the . Please upload a PDF, DOC, or DOCX file. Jul 22, 2021 · For simplicity, we return the 200 status code. Client-side: Call a jQuery Ajax method. This is the client side code: Presentation: Logic: const onChange = (e) => {. The InputFile component renders an HTML <input> element of type file. Drawing. This demo shows how to allow only specific file types for upload. [HttpPost] public async Task<ActionResult<User>> PostUser(User user, [FromForm] IFormFile file) { _context. EUWest2); private string _bucketName = "mis-pdf-library";//this is my Amazon Bucket name. And the image we are receiving in request body in Base64 string format in web api controller. NET Core. txt, more May 10, 2020 · I try to upload a image from react hooks to ASP. NET Core Web API & MVC web app (MVC) projects. ihave been following this tuto (File uploads in ASP. NET 6. Step 3. Jan 17, 2018 · you can see I'm using CDN and CKeditor version 4. await file. Here is the HTML and JS class I have. Controller Code. Net core. NET is the . Successful file uploading has three basic requirements: The form must use the post method. 1 and Empty project and Click Create. SaveChangesAsync(); // save to image or do any of your work. 0 MVC. Net Core Web APIIn this tutorial, we discuss how to upload images in Reactjs with Asp. <input type="file"> binding with angular using ngModel or formControlName will only catch the value property but actually when we submit form we need the files property so we can create custom directive that will apply to all the project <input type="file"> elements so when we submit the form we got the file property. Net Core Web App (MVC) and click on the next button. NET Zero license and already created an empty project by following Getting Started document. HtmlEncode(myString); to HTML encode it. From web application controller I will get image and I need to send image to web API. Feb 19, 2018 · To create a REST service, we create an ASP. To try it out sign up for a free 30-day trial. Step 13. I am trying to upload a . private static string _bucketSubdirectory = String. The Telerik UI Upload TagHelper and HtmlHelper for ASP. NET Boilerplate. NET Core Angular CRUD Application - Part 2; ASP. Nov 11, 2019 · I have ASP. MapPath("~/Update/" + file. In CSharp code: public ActionResult UploadImage(HttpPostedFileBase file) {. Here's my code: Web API: public int Oct 10, 2023 · Upload and display an image in the ASP. com. NET Core build of Magick. SaveAs("<give it a name>"); return Json(new { location = "<url to that file>" }); } You should be able to copy and paste image to your textarea (strange, drag and drop doesn't work anymore). public void CreateImage([FromForm] ImageDTO img) {. Create an Action Method in the Controller class. NET Core MVC web development with controllers and views. The root directory must be writable, otherwise the upload directory will not be created. public void ConfigureServices(IServiceCollection services) {. Create a page to insert a list of employees. 💡. cs which is used by the ImageController to call the image writing component of the program by injecting the handler into the controller. net controller using this answer: File upload using Asp. You can get more examples on GitHub or other sources. 2) You cannot control the size explicitly: only the quality. Zahid Sep 12, 2019 · You can use string untrustedFileName = Path. cs file. Yes it is. png, ImageFormat. NET Core Razor Pages validate the Antiforgery Token in POST requests. One for "User" and other for the "Image". NET Core 6. Steps: Change the Controller action. public class FileViewModel. The UI for ASP. Hot Network Questions Valid confidence intervals in GAM’s using shrinkage Nov 10, 2015 · images_upload_base_path: '/some/basepath'. NET Core Upload is a server-side wrapper for the Kendo UI for jQuery Apr 28, 2017 · To persist/save the file to disk you can do the following: using (var stream = new FileStream(path, FileMode. NET Core MVC". But for UX purposes, the user (the owner of the e-commerce) to fill the Product model and uploading the image in the same page, and do the POST in the same form. Magick. NET core , VueJS app. NET Core, you need to start by setting up the necessary services in the Startup. NET Web API and stuck in uploading base64 image. Jul 13, 2021 · Learn how to upload images of CK-Editor in . net core, we need to use the IFormFile, so, create a FileViewModel, like this: Copy. I have written a function UploadProfilePicture in Jan 3, 2024 · Introduction. NET Core, a professional-grade UI library with 110+ components for building modern and feature-rich applications. Create IAppConfiguration interface and class name as AppConfiguration. Here are the steps needed to store an image in a database from an MVC application. "ImageDir": "<Your Folder Directory Path>". js is a Custom javascript file you can create it in your project. I found this Microsoft documentation: Jan 12, 2020 · Write Storage in the search box and then click Storage. User. 10. UploadFiles(files[]) The upload file method takes a list of files and inserts them into the data base. file. Update the Create. Accepts<IFormFile>("text/plain"); line to your desired ContentType. 1 [ApiController] 2 [Route("file")] 3 public class FileController : ControllerBase 4 { 5 [HttpPost] 6 public IActionResult Upload([FromForm] IFormFile file) 7 { 8 // code responsible for file processing 9 return Ok(); 10 } 11 } Ok, now we want to send a request to this endpoint from another app Jul 11, 2020 · I want to upload image from my Angular application to . NET MVC application. setPersonPhoto(e) let form = new FormData(); Sep 4, 2022 · The IFormFile interface causes problems when I try to convert a string to an IFormFile with view model / Dto and get a status 400 with an error: The JSON value could not be converted to Microsoft. GetTempFileName(); to get a temporary file name and directory. Nov 8, 2019 · 2. Feb 15, 2020 · Anyway, to accomplish the file uploading, we can divide it into two parts. So, Click on Create bucket.
jq na wi ah jx fq wn ov fx db