![]() |
| ||
| file upload Hi I am trying to upload an excel file to the server. But it won't work, every time I am trying to upload an xls file and press the button. it writes: No file was uploaded. as if i had no file. you are welcome to try on: http://radio.web.surftown.dk/admin/indset_program.aspx the top section where you can upload a file from your computer my code looks like this: protected void Button2_Click(object sender, EventArgs e)Hope someone can help? |
| ||
| Re: file upload FileUploader control does not work in the upload panel. In other words, it isn't Ajax compatible control. You need to do a regular postback through a trigger. It's a security constraint in the design of the component. You can look it up on msdn. |
| ||
| Re: file upload I am not using Ajax. I using an ordinary button. So isn't that a regular postback? |
| ||
| Re: file upload Okay, i just saw a reference to Update Panel in your page code, but your upload control is declared outside of it. Use breakpoints and run your page in debug mode. Set break points inside of the first if statement and see what you're getting in FileUpload.PostedFile. Check for any internal errors and property values. Also, don't use system.io to save the file. You can do so with FileUpload.PostedFile.SaveAs(); |
| ||
| Re: file upload Ok I put some breakpoints at: if (FileUpload.PostedFile != null) and int nFileLen = myFile.ContentLength; And when i move the curser over: int nFileLen = myFile.ContentLength; it writes: myFile.ContentLength 0 does that meen that it thinks that the file doesn't fill more than 0? and how do I change that? |
| ||
| Re: file upload Quote:
|
| ||
| Re: file upload //use System.Web.UI.HtmlControls.HtmlInputFile >> filSelectFile string nameOfFile = filSelectFile.Value;//Get selected file //Get actual file name int last = nameOfFile.LastIndexOf("\\"); nameOfFile = nameOfFile.Substring(last + 1); //Saving location //this must be virtual folder of your web server string uploadFolder = ConfigurationSettings.AppSettings["FileUploadFolder"]; nameOfFile = uploadFolder +"\\" + nameOfFile; //Upload the file filSelectFile.PostedFile.SaveAs(nameOfFile); |
| ||
| Re: file upload The autentication was allready set to Windows. Quote:
Thanks |
| ||
| Re: file upload I got it to work now, it was just a stupid typo. Sorry I didn't see it earlier. But thank a mill for your help. :-D |
| All times are GMT -4. The time now is 3:43 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC