Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

When I click on upload button it says that my fileupload does not contain a file. Why that? Did I miss something in my code?

                //Add profilepic to SP list
                SPList myProfileDocList = web.Lists.TryGetList("Employee documents");

                SPListItem profileDocListItem = myProfileDocList.Items.Add();
                profileDocListItem["Title"] = strUserName;

                if (FileUploadEmployeeDoc.PostedFile != null && FileUploadEmployeeDoc.HasFile)
                    Stream fStream = FileUploadEmployeeDoc.PostedFile.InputStream;
                    var profPicContents = new byte[fStream.Length];
                    fStream.Read(profPicContents, 0, (int)fStream.Length);
                    SPAttachmentCollection profileDocAttachment = profileDocListItem.Attachments;
                    string profPicFileName = Path.GetFileName(FileUploadEmployeeDoc.FileName);

                    profileDocAttachment.Add(profPicFileName, profPicContents);

share|improve this question

1 Answer 1

Sir, it would be great if you could provide some more information about the problem. What are you trying to do? In which context? Thanks!

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.