Skip to Content
0

How to store image in folder in sapui5

Jun 10, 2017 at 10:02 AM

113

avatar image
Former Member

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.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Sharath M G Jun 11, 2017 at 05:14 AM
0

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;
    }
Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Jun 12, 2017 at 05:35 AM
0

Hi Sharath,

Thanks for giving the answer but It isn't working. It shows error in my SAP webide.

imageup.png


imageup.png (23.3 kB)
Show 1 Share
10 |10000 characters needed characters left characters exceeded

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

0