Solved

How to upload file to webserver

Posted on 2015-02-19
8
62 Views
Last Modified: 2015-03-09
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
0
Comment
Question by:VBdotnet2005
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 14

Expert Comment

by:frankhelk
ID: 40619583
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).
0
 

Author Comment

by:VBdotnet2005
ID: 40619602
I am sorry. I am meant in aspx. I am trying to vs2010 to upload files to my shared network drive.
0
 

Author Comment

by:VBdotnet2005
ID: 40619605
How can I map it from IIS?
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 14

Expert Comment

by:frankhelk
ID: 40619734
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 ?
0
 

Author Comment

by:VBdotnet2005
ID: 40619805
"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.
0
 
LVL 14

Expert Comment

by:frankhelk
ID: 40620891
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.
0
 

Author Comment

by:VBdotnet2005
ID: 40621517
Do you have a sample of #2 option?
0
 
LVL 14

Accepted Solution

by:
frankhelk earned 500 total points
ID: 40621582
Just create a new folder within C:\Inetpub\wwwroot and set the permissions as given in the example (let's say C:\Inetpub\wwwroot\thefiles.

Then just change Data to thefiles in the relevant section of the aspx code (as written above).

Don't create any folder in VS.

That way your code knows wher to drop the files, but VS doesn't think the path is part of your project.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question