Try our conversational search powered by Generative AI!

Uploading file code snippet?

Vote:
 

Hi!

Does anyone have a code snippet showing how to upload a file to a folder (Global Files, Documents or such) in the EPiServer File Manager?

I'm currently using CMS 5 R2.

#44892
Oct 20, 2010 9:10
Vote:
 

Use ASP FileUpload control and read some tips here:

http://blog.fredrikhaglund.se/blog/2007/12/05/episerver-using-the-new-unified-file-system/

#44893
Oct 20, 2010 9:32
Vote:
 

Yes, Fredrik's blogpost sums it up nicely.

Beware however to not use the FileUpload.FileBytes as mentioned in one of the comments as this will bring in the complete file contents into memory, something that can be disastreous - imagine what happens if someone uploads a 3Gb file.

Instead get the FileContent streaam and read/write in reasonably sized chunks.

/johan

#44894
Oct 20, 2010 9:56
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.