Skip to Content
avatar image
Former Member

How to store image in folder in sapui5

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Jun 11, 2017 at 05:14 AM

    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;
        }
    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 12, 2017 at 05:35 AM

    Hi Sharath,

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

    imageup.png

    Add comment
    10|10000 characters needed characters exceeded