0

I am trying to call a public function inside a public class in my web application but for some reason the function is not accessible even though I can get to the class fine and the function is marked as public. When I call FileUploader, the only options I am given are equals and referanceequals. What stupid thing am I over looking? Please not that the class is in a secondary project called Classes in my app. I do not have problems accessing a difference class in the project that FileUploader is in.

using System;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Auth;
using Microsoft.WindowsAzure.Storage.Blob;
using Microsoft.WindowsAzure;
using System.IO;
using System.Configuration;
using FFInfo.Classes;

namespace FFInfo
{
    public partial class FUTest : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if (fuFile.HasFile)
            {

            }
        }
    }
}

FileUploaders.cs

    using FFInfo.DAL;
using FFInfo.DAL.Tables;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Blob;
using System;
using System.Web;

namespace FFInfo.Classes
{
    public class FileUploader
    {
        public Int64 UploadSiteImage(string ConnectionString, string ContainerName, string FilePath, HttpPostedFile UploadedFile)
        {
            CloudStorageAccount SiteImages = CloudStorageAccount.Parse(ConnectionString);
            CloudBlobClient SiteImagesBlob = SiteImages.CreateCloudBlobClient();
            CloudBlobContainer SiteImageContainer = SiteImagesBlob.GetContainerReference(ContainerName);
            SiteImageContainer.CreateIfNotExists();
            CloudBlockBlob Image = SiteImageContainer.GetBlockBlobReference(FilePath + UploadedFile.FileName);

            using (UploadedFile.InputStream)
            {
                Image.UploadFromStream(UploadedFile.InputStream);
            }

            using (var db = new Compleate())
            {
                File NewFile = new File()
                {
                    ContainerName = ContainerName,
                    FilePath = FilePath,
                    FileName = UploadedFile.FileName,
                    ContentType = UploadedFile.ContentType
                };

                db.Files.Add(NewFile);
                db.SaveChanges();
                return NewFile.FileID;
            }
        }
    }
}
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • Right click your other project and select 'build'. If that isn't it, I need to see where you are instantiating the object. – Mike C. Mar 12 '13 at 23:06

2 Answers2

1

Did you perhaps mean for the UploadSiteImage method to be static?

  • 1
    Yes it was the static call. Told you I was missing something stupid. –  Mar 12 '13 at 23:23
0

Try (new FileUploader()). <-- will get intelisense here.

But, yeah, you probably want the method to be public static

pero
  • 4,169
  • 26
  • 27