Link to home
Start Free TrialLog in
Avatar of VBdotnet2005
VBdotnet2005Flag for United States of America

asked on

How to upload file to webserver

Hi,
 I am following this sample and it works fine. I have a queston on creating data directly where to upload files to.
 Does the directory has to be in the same project? The problem is when I deploy my project, it clean out my files on that directory on webserver.  How can I save to a network folder? Link sample
Avatar of Frank Helk
Frank Helk
Flag of Germany image

Usually webserver providers provide you with a FTP account, too, that allows you to upload anything into your webspace. You might use that with your browser, with Windows Explorer, or (best choice) a dedicated FTP client life i.e. FileZilla (which I recommend).
Avatar of VBdotnet2005

ASKER

I am sorry. I am meant in aspx. I am trying to vs2010 to upload files to my shared network drive.
How can I map it from IIS?
I havn't done web dev wit VS yet ... but when comparing the behaviour of .NET projects, I would suppose you could add the files as ressources to your project ?
"add the files as ressources to your project ? ", why would you do this? I am just curious. In my condition, my project would just keep bigger and bigger.
OK - maybe I was on the wrong path ... I've looked a bit deeper into that example project ...

In the example, the data folder is part of your project, and therefore VS cleans it up too before dumping the new project files into place. I'm sorry, but the next part is speculative ... I see two possible ways:

There might be some option in your project (probably in the properties of the example folder that ends up in C:\Inetpub\wwwroot\CSharpUpload\Data ) which prohibits the cleanup of that folder while dploying
You could just create an independent path in your IIS wwwroot folder which is not managed by VS. Y'll have to tune the code that saves the file (in the example probably the string SaveLocation = Server.MapPath("Data") + "\\" +  fn; sequence) to match that location. If VS doesn't know the folder, it couldn't clean it up.
Quick & Dirty: Since VS has already created that path, it might be sufficient to just remove it from your VS project. With a little luck VS doesn't remove the directory and leaves your file alone in the future.
Do you have a sample of #2 option?
ASKER CERTIFIED SOLUTION
Avatar of Frank Helk
Frank Helk
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial