These forums are read-only and considered to be an archive. Please use the new Community for future interaction and posts.

Uploading Event--No Files

I want to skip files that already exist on the server.  I was hoping the Uploading event would be where I could do that.  I added the code below and added the event handle to the control.   The event fires, but the e.UploadProgress.UploadedFiles is empty.  Why????  Is there another way to do this?

    private static void FileVistaControl_Uploading(object senter, FileVistaUploadingEventArgs e)
    {
        int x;
       
        for (x = 0; x <e.UploadProgress.UploadedFiles.Count; x++)
        {
            string fp = e.UploadProgress.UploadedFiles[x].FullPath;
            if (File.Exists(fp))
            {
                e.Cancel("File " + Path.GetFileName(fp) + " alread exists on server.");
            }
            
        }
    }
Bob Moffa 8/31/2010 8:10 AM
Please see this topic:
FileName in Uploading handler
Cem Alacayir 8/31/2010 8:32 AM
So its basically pretty useless to use that event.   How about adding a "no overwrite" option.  So existing files can be skipped without stopping the rest of the upload operation.   I have tried turing off the Edit permission, but that causes the entired upload process to stop at the first occurance of an existing file.
Bob Moffa 9/1/2010 8:24 AM
Actually, Uploading event was useful before v2.0 because all upload modes were processed with our ajax upload module. However, the ajax upload module does not work with Medium-Trust level so we made Flash and Browser upload modes to use ASP.NET's default upload mechanism. For this reason, in these modes we can not access upload information until the upload is completed (ie. server receives the whole file). However, if you use Ajax mode, you can still access upload information in Uploading event but this time your project will require Full-Trust level.

I have noted your suggestion and we will improve upload related events in future versions.
Cem Alacayir 9/1/2010 2:44 PM