Example #1
0
        public static void BeginUpload(string path, string fileName, int versionId, int propertyTypeId, long fileSize)
        {
            var key = GetSessionId(path, versionId, propertyTypeId);
            lock (_sync)
            {
                var session = Get(key);
                if (session != null)
                    throw new ApplicationException(string.Concat("The attachment already saving. Path: {0}, Property: {1}", path, ActiveSchema.PropertyTypes.GetItemById(propertyTypeId).Name));

                var binId = DataProvider.Current.InitializeStagingBinaryData(versionId, propertyTypeId, fileName, fileSize);

                session = new PsUploadSession { BinaryDataId = binId, LastChunk = -1 };
                _sessions.Add(key, session);
            }
        }
Example #2
0
        public static void BeginUpload(string path, string fileName, int versionId, int propertyTypeId, long fileSize)
        {
            var key = GetSessionId(path, versionId, propertyTypeId);

            lock (_sync)
            {
                var session = Get(key);
                if (session != null)
                {
                    throw new ApplicationException(string.Concat("The attachment already saving. Path: {0}, Property: {1}", path, ActiveSchema.PropertyTypes.GetItemById(propertyTypeId).Name));
                }

                var binId = DataProvider.Current.InitializeStagingBinaryData(versionId, propertyTypeId, fileName, fileSize);

                session = new PsUploadSession {
                    BinaryDataId = binId, LastChunk = -1
                };
                _sessions.Add(key, session);
            }
        }