Uploaded MediaData blob is empty

Vote:
 

Hi

Locally everything works fine, the blob write is craeteing the complete medidata blob.

But, on the stage server, the file is created, i can see the file in 

\blobs\19130d49edd84c2483d6c44169fc1e5e\c58b93637cd84d7690e604a2aec03912.jpg

But the file's size is 0 KB ...

So create persmissions should be ok, since the file is there, but why no data?

How can it differ from my local machine?

I can't find any good documentation on this....

/Fredrik

#79009
Dec 06, 2013 11:38
Vote:
 

Adding some info to the case...

Locally I had the local IIS (Express/ Cassini or whatever), and that worked fine

Now I switched to my local IIS 7.5, and same problem occur as on the stage server, files are 0 bytes.

Even though I tried with app identity "LocalSystem".

Sounds familiar?

#79014
Dec 06, 2013 13:46
Vote:
 

Solved!

It turned out that I was doing something wrong with the blob writing, it never worked ...


When uploading files with http it is enough with:

var contentRepository = ServiceLocator.Current.GetInstance<IContentRepository>();
var blobFactory = ServiceLocator.Current.GetInstance<BlobFactory>();

HttpPostedFile file = Request.Files[0];

var file1 = contentRepository.GetDefault<GenericMedia>(publikation.AssetFolder);

string filename = DateTime.Now.ToString("yyyy-MM-dd_HHmm") + Path.GetExtension(file.FileName);

file1.Name = filename;

var blob = blobFactory.CreateBlob(file1.BinaryDataContainer, Path.GetExtension(file.FileName));

blob.Write(file.InputStream);

file1.BinaryData = blob;
item.FileRef = contentRepository.Save(file1, SaveAction.Publish, EPiServer.Security.AccessLevel.NoAccess);

    

#79020
Dec 06, 2013 15:16
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.