I am not able to upload my file to server folder kindly help me..could you please explain we need to create a server side code to upload my file or simply call the save api .
flexmonster.save({
filename: 'myreport.json',
destination: 'server',
url: 'http://localhost:52343/Files/',
licenseKey: "----"
//filename: 'myreport.json',
//destination: 'file'
});
or if i need to create a server side code how to send the file to my function kindly help asap.
url: 'http://localhost:52343/Pivot/upload',
I created upload method to catch the file in Pivot controller.
Kindly help what to do.
Hello Rohit,
Thank you for writing. Please have a look at the following article about save()
API call: https://www.flexmonster.com/api/save/. When you need to upload the report file to the server it is necessary to write a server-side script which handles the POST request and saves the file. Here is the code example for PHP:
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods', 'OPTIONS,GET,PUT,POST,DELETE');
header('Access-Control-Allow-Headers', 'Content-Type');
$type = $_POST['type'];
$name = $_POST['name'];
$report = $_POST['report'];
$success = file_put_contents($name, $report);
if ($success) {
echo "Report saved successfully!";
} else {
echo "Failed to save report.";
}
The Flexmonster code will look like the following:
flexmonster.save({
filename: 'myreport.json',
destination: 'server',
url: 'http://localhost:52343/saveReport.php'
});
Please let us know if the information above was helpful for you.
Regards,
Dmytro
Hello team can you provide the .net server side code or javascript beacuse i m not using PHP, kindly help.
Hello, Rohit,
Thanks for your update.
The steps for saving the file to the .net server are just the same, you need to save the file which you will get via the POST request for http://localhost:52343/Files/
.
This question should help you to save the file successfully: https://stackoverflow.com/questions/15072040/how-to-save-a-post-request-content-as-a-file-in-net
Please let me know if you have other questions.
Regards,
Tanya
Hie Team could you please help me to get my file here is my code kindly help asap.
my js ----
function up()
{
flexmonster.save({
filename: 'myreport.json',
destination: 'server',
url: 'http://localhost:52343/Pivot/up',
licenseKey: "-------------"
});
}
----my html --
@using(Html.BeginForm("up", "pivot", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
<div class="col-sm-2">
<button type="submit" class="btn btn-success" style="margin-top: -14px;" id="btn_up" ;">Upload</button>
</div>
}
--- my controller ---
public ActionResult up()
{
var file = Request.Files["myreport.json"];
return RedirectToAction("Report");
}
what is wrong im doing kindly help..how to call js and get my file to controller.
Hello Team above query has been solved, appreciated for your help.
Hi Rohit!
We're glad to hear that your question has been resolved. Thanks for letting us know.
Kind regards,
Illia
Flexmonster Team
Hie Team i have another question how to change sql date to json date before binding, i have dynamic json data as per retirement,
kindly help.
Hello, Rohit,
Could you please specify more details about your use case?
Regards,
Tanya
My date column is showing other wrong format, is there any option to change it or i have to wright some function to convert it.
i have problem because my date column is not same every time(index) it is dynamic data ,kindly help me to get regular date format from my sql database.
Hello Rohit,
It seems that your date input format is not correct. We recommend you trying our compressor tool. It makes the process of connecting to SQL databases much easier.
Please find more information in our documentation: https://www.flexmonster.com/doc/connecting-to-relational-database-with-net/.
Let us know if it solves the case.
Regards,
Dmytro