Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
395
Different Location to upload files to
posted

Hello,

I'm new to Infragistics Web library and i want to use the WebUpload-Control in my ASP.NET-WebApp. As i saw, the file upload path will be set in the web.config-settings. In my app each user has a different location on the webserver where he can put the files into. Is it possible to set the upload path dynamically. Has anyone an example/snippet to do that?

Thanks

Martin

Parents
No Data
Reply
  • 1800
    Verified Answer
    posted

    Hi Martin,

    WebUpload control allows you to manipulat(delete, move, copy, etc) uploaded files as you want. First the file upload path that you configure in web.config is file for temp folder where all files are saved while uploading. Btw while uploading they are with unique names (that are generated from Upload HttpModule). If you do not bind to event UploadFinishing then the uploaded file is renamed to its original file name(if there is a file with the same name it will be overwritten). To achieve your target you should only bind to the server-side event UploadFinishing. In the event handler you can just cancel this event and to move it to the folder you want (or to manipulate the file as you prefer). Samples you can find in the samples browser. For instance here is a link: http://samples.infragistics.com/aspnet/Samples/WebUpload/Display/MultipleUpload/Default.aspx?cn=web-upload&sid=a8c69ee2-99e1-4512-938b-52c5d0b9cb6f. You should choos from the section CODE VIEW from the dropdown file Default.aspx.cs where you can see that we have bound to this even. The event handler is with the name webUpload1_OnUploadFinishing. There we get the name of the file (as I said it is with unique name) and you can move it to the folder you prefer. In the event arguments you can get the original file name.

    Thanks,

    MIro Hristov

Children