What I am doing is to create a view for Image Uploader. I am getting problem when I am uploading image in my sapui5 app.
I want to store image in my app folder and save image URL in backend.
Try this piece of code:
private string UploadFile() { Random rand = new Random(); //string imagepath; int guid = rand.Next(); string ext = Path.GetExtension(FileUpload.FileName); string Serverpath; Serverpath = "~/Upload/" + guid.ToString() + ext.ToString(); //string filepath = MapPath(Serverpath).ToString(); FileUpload.PostedFile.SaveAs(MapPath(Serverpath)); return Serverpath; }
Hi Sharath,
Thanks for giving the answer but It isn't working. It shows error in my SAP webide.
Probably it's the fileupload class. Check in UI5 library, the relevant class to post the file.
Go through explored link in SAPUI5.
Regards,
Sharath