can anyone help with .net

nocilah

Banned
Joined
Sep 2, 2004
Messages
7,623
Reaction score
3
Location
hopefully heaven but probably hell
hi... i know nothing about asp.net.

I am trying to create a simple upload page. now i have managed to create an html version, but what i want is to create a flash version using the new command in flash 8 (import flash.net.FileReference) which allows you to popup a browse for file window.

from flash I then point to my aspx file but with little results and i believe the probelm is on the aspx side.

what i would like to know is if anyone can see anything wrong with the following code:

Code:
<script language="C#" runat="server">
      string saveToFolder = 'c:\myserverpathhere'
        private void Page_Load(object sender, System.EventArgs e)
        {
          
            HttpFileCollection uploadedFiles =  Request.Files;
            string Path = Server.MapPath(saveToFolder);
            for(int i = 0 ; i < uploadedFiles.Count ; i++)
            {
                HttpPostedFile F = uploadedFiles[i];
               
                if(uploadedFiles[i] != null && F.ContentLength > 0)
                {   
                    string newName = F.FileName.Substring(F.FileName.LastIndexOf("\\") + 1);
                    F.SaveAs(Path + "/" + newName);
                }
            }
        }

EDIT: Google is yeilding very little responses :( i have got tonnes of php examples, but i only use .net framework.
 
Last edited:
What exactly is not working? Is .NET throwing some sort of exception, and if so what is the exception?

One thing that might be a problem is access rights. You need to make sure that the ASPNET user has write access to the folder where you want to save the files
 
jerriep said:
What exactly is not working? Is .NET throwing some sort of exception, and if so what is the exception?

One thing that might be a problem is access rights. You need to make sure that the ASPNET user has write access to the folder where you want to save the files

well i have a webform based one working perfectly... it uploads and everything.

With the flash version i dont think the aspx is correct... i am wondering if it has somethign to do with this command? Cuz flash is calling the aspx page and not a web form anymore... so not sure what code to use as i am a complete NOOB when it comes to .NET as i have 14 hours experience to my name :)

Code:
Sub Upload_Click(source As Object, e As EventArgs)

I dont know if this should happen with some Page load command?

EDIT: to answer you question, with the flash version it seems to upload... but it doesnt... and i have no idea why.

flash code =
Code:
listener.onSelect = function(selectedFile:FileReference):Void {
  statusArea.text = details.text = ""
  statusArea.text += "Attempting to upload " + selectedFile.name + "\n";
  selectedFile.upload("upload.aspx");
};
 
Last edited:
scatlett said:
I don't understand why we need to have a programmer's thread here. We should all be supporting www.sadeveloper.net

I thought everyone here was in favour of competition?

Never knew it existed, actually.
 
Thanks for the link! :) Will check it out... have always been using international forums until now.

Edit: Have checked it out, and seems to focus on M$ only... :(
sadeveloper.net said:
specialising in Microsoft-oriented content
 
Last edited:
scatlett said:
I don't understand why we need to have a programmer's thread here. We should all be supporting www.sadeveloper.net

You tend to get, what, more than 800 unique visitors here per day (actually, if you look at the statistics, more)

So the chances of someone answering your question within 5 minutes of it posting (seeing as most of us are on deadline) is helpful.

You may know my nick from sadeveloper.net as well, and even though one or two people there try and help you, it is usually slow and you have to wait week(s) to get an answer IF any.

So, I reckon this is the coolest place to start chatting about these things seeing as how dead the forums are over there. I'd definately go there for the articles...
 
Top
Sign up to the MyBroadband newsletter
X