SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

FileUploadControl.HasFile always returns false.

When I tried using HttpFileCollection

HttpFileCollection files = Request.Files;

after adding System.Web Namespace it says 'Request' does not exists in the current context.

Is there any way to use FileUpload control in sharepoint sandbox?

share|improve this question
up vote 1 down vote accepted

This is prohibited by the Sandbox user process and the sandboxed object model. Most properties of the ASP.NET objects (such as Page, Request, Response etc) are marshalled from the w3wp.exe process to the user code process into new "sandboxed" copies of these objects. The Request.Files property is on of those objects that is not copied. It's more of a resource issue than a security issue.

share|improve this answer
The requirement is to upload files to Document library from FileUpload Control, is there any other way to do this, in sandbox solution. – Marcus Mar 27 '12 at 13:48
You can use a Silverlight app to achieve this. – Wictor Wilen MCA MCM MVP Mar 27 '12 at 16:25

you can't do that because this is a security issue.

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.