We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Explain about making "JSON" ajax request with our provided PHP service

Making PHP service for FileExplorer

In this section, we will see about creating PHP service for FileExplorer using XAMPP application and configuring and making JSON based AJAX request from client side to the created FileExplorer PHP service.

 

First create a FileExplorer service using XAMPP.

Usually, the XAMPP gets installed in C:\\ drive. Now, create a new service folder namely FileExplorerPHP within `C:\\xampp\\htdocs` and place all the below mentioned folders within it.

 

  1. "FileBrowser" folder and its content, which is exposed by FileExplorer. (It may contain any file or sub folder)
  2. Copy the file operation handling files from following installed location of your system
  • C:\Program Files (x86)\Syncfusion\Essential Studio\{15.1.0.37}\PHP\Src\Services\FileExplorer

and paste it to the XAMPP server location as shown below

  • C:\\xampp\\htdocs\\FileExplorerPHP

 

The above created sample is now ready to run. Therefore, open the XAMPP control panel and start the Apache module as shown in the below image.

 

C:\Users\balamuruganp\AppData\Local\Microsoft\Windows\INetCacheContent.Word\getting-started_img2.png

 

 

 

Configure AJAX settings in client side to make request to the PHP service of FileExplorer

In client side, now you need to configure the AJAX request for loading and exposing the necessary folder content from filesystem of the PHP server.

 

By default, internally we have make AJAX request in FileExplorer with “application/json as content type. But it causes problem in receiving AJAX request parameters in PHP service, so we need to modify the AJAX content type in sample level.

 

In below code block, you should note the “beforeRequest” method. In this method, we will modify “contentType” for the “ajaxSettings” property as “application/x-www-form-urlencoded. That helps to make the “JSON” based AJAX request to the PHP service along with standard content type and get the proper response from that.

 

 

 

 

Now, the sample can be run directly on the browser through localhost with appropriate port numbers, on which the Apache server is currently listening. For example, say if the Apache is configured to listen on port 7777, then make request to service as shown in above code block.

Article ID: Published Date: Last Revised Date: Platform: Control:
7921 08/03/2017 08/03/2017 PHP FileExplorer
Tags:
php
Did you find this information helpful?
Add Comment
You must log in to leave a comment

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon