Error:Could not find a part of the path

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • Curtis Rutland
    replied
    OK, here's a Draft of the article. It might move around or change a bit, but you can read it now.

    Leave a comment:


  • Curtis Rutland
    replied
    OK, sorry, things have taken much longer than I wished, but I have finished the project. I will write the article about the project soon. It was an interesting one, that's for sure.

    I'll post a link in this thread to the article once it comes up.

    Leave a comment:


  • E11esar
    replied
    Interesting

    Very interesting - thank you for your help. I guess it is time I bit the bullet and started to study Silverlight.

    :)

    Leave a comment:


  • Curtis Rutland
    replied
    Just to let you know, I'm working on writing a program like the one I described, and I will write an article about it, describing how.

    It should be done in a day or so.

    Leave a comment:


  • Curtis Rutland
    replied
    Videos : The Official Microsoft Silverlight Site

    This URL might be of interest. It's a sample on how to use silverlight to upload a file through a webservice (i think...i'm pretty sure this is the video I watched that showed that ;))

    Now, if this is the video I think it is, i think it uses a REST service, but you could write that as an ASMX or WCF service just as easily, and use a real service reference in your app.

    Leave a comment:


  • Curtis Rutland
    replied
    It's a lot like flash in some ways...it's a rich client side plugin. But you really don't program it the same way...it's not on a timeline.

    It is more like an applet than anything, but with much less overhead.

    Leave a comment:


  • Frinavale
    replied
    Originally posted by Plater
    Think of silverlight as a mix between flash and java applets. That's how I look at it.
    I don't know about the "Flash" part....
    Have you tried using it before?

    Leave a comment:


  • Plater
    replied
    Think of silverlight as a mix between flash and java applets. That's how I look at it.

    Leave a comment:


  • Frinavale
    replied
    Originally posted by insertAlias
    Well.....ASP.NE T isn't going to be the best way to process multiple files, unless you want to dynamically create multiple FileUpload controls.
    This is one of the reasons why most web sites have restrictions on the number of files you can upload.

    Originally posted by insertAlias
    When you "save" files in silverlight, you are actually using local storage on the client's computer. So you can "save" a batch of files locally, and then process them.
    I had no idea that silverlight could do this....
    This is a very good excuse to check out silverlight tonight :)

    Leave a comment:


  • Curtis Rutland
    replied
    Well.....ASP.NE T isn't going to be the best way to process multiple files, unless you want to dynamically create multiple FileUpload controls. If it were me...I'd look into using a Silverlight control and a web service. When you "save" files in silverlight, you are actually using local storage on the client's computer. So you can "save" a batch of files locally, and then process them. Write a web service or WCF service that will take a byte[] or maybe a List<byte[]> to do them all at once and do the batch processing, and return a status.

    Well, your simple project just got much more complicated :(

    Leave a comment:


  • E11esar
    replied
    Web server files

    Oh that is not good news then..!

    Sorry to be a pain but what should I do in this case for when this is running on the server?

    Is it best to use the asp.FileUpload and the SaveAs method to save the target file to the uploading directory?

    If this is the case then I will be back at square one as I need to process a batch of files and didn't want to add FileUpload's to the web form.

    Also to add to this, I am now finding that my current approach is copying across an empty file, whereas the source file is greater than zero bytes..?

    Looks like my premature "it is working" was unfounded..!

    M :)

    Leave a comment:


  • Curtis Rutland
    replied
    Just to save you this headache later....

    This isn't going to work once you start testing it from a real webserver rather than your local machine. The server doesn't have any access to your filesystem, so saying File.Copy or whatever will look on the server's file system not the client's. It's working right now because those are the same; you're browsing from your server.

    Remember that all .net code is processed and handled on the server.

    Leave a comment:


  • E11esar
    replied
    Solved it

    Hi again, I have just solved it.

    The answer was to append the fileName as mentioned above, hence I used the following code to solve the problem:

    foreach (ListItem listFileName in fileList.Items)
    {
    try
    {
    .
    .
    .
    string sourcePath = listFileName.Te xt;
    string destPath = Path.Combine(im portFolder,Path .GetFileName(li stFileName.Text ));

    //Copy file, overwriting if necessary
    File.Copy(sourc ePath, destPath, true);
    .
    .
    .

    This then has done the trick.

    Thank you for your help.

    M :)

    Leave a comment:


  • Plater
    replied
    Ok, so do the users ever actually upload the file to you and you write it out to the directory?

    For instance:
    [code=c#]
    string filename = myFileUpload.Fi leName;
    byte[] filebytes = myFileUpload.Fi leBytes;
    string path = myLogPath;
    string pathandfile = path+@"\"+filen ame;
    try
    {
    FileInfo fi = new FileInfo(pathan dfile);
    FileStream fs = fi.Open(FileMod e.Create, FileAccess.Writ e);
    fs.Write(fileby tes,0,filebytes .Length);
    fs.Flush();
    fs.Close();
    fs.Dispose();
    }
    catch (Exception ee)
    {//todo: log an error??

    }
    [/code]

    Leave a comment:


  • E11esar
    replied
    A bit more

    I also have the importFolder defined as

    private const string importFolder = @"C:\Uploads \";

    Thank you.

    M :)

    Leave a comment:

Working...