Hm saving file to HD doesnt work...

classic Classic list List threaded Threaded
27 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Hm saving file to HD doesnt work...

Guest-19

Hi,

 

i just downloaded NeatUpload and started the demo.aspx, i just modified 1 line, so i can save the choosed file to HD like it is written in ur step by step documentaion...but somehow it doesnt work... the progress bar shows that its finished but the file is nowhere to find...

"inputFileId.TmpFile.MoveTo(Path.Combine(Request.PhysicalApplicationPath, 
Path.GetFileName(inputFileId.FileName)));"

thats the only line i insert to the Page_PreRender method...

 

what im doing wrong ? thx for help !


Reply | Threaded
Open this post in threaded view
|

Re: Hm saving file to HD doesnt work...

Dean Brettle
Administrator
It should be in the same directory as Demo.aspx.  If not, I need a little more info:

1. Is any sort of exception/error being displayed?
2. Is the server running on Windows, Linux, or something else?
3. What browser did you use to do the upload?
4. What does the Demo.aspx page display for the "Name:" of the uploaded file after it has finished uploading?

For testing purposes, try replacing:

inputFileId
.TmpFile.MoveTo(Path.Combine(Request.PhysicalApplicationPath, Path.GetFileName(inputFileId.FileName)));

with

inputFileId.TmpFile.MoveTo(Path.Combine(Request.PhysicalApplicationPath, "test"));

After the upload, a file named "test" should then appear in the same directory as Demo.aspx.  Note: you'll need to delete it before each subsequent upload because MoveTo() will throw an exception if it already exists.

Hope that helps,
--Dean

Reply | Threaded
Open this post in threaded view
|

Re: Hm saving file to HD doesnt work...

Guest-19

Hi,

thx for the answer,

well unfortunately no error msg, it is a Windows XP Prof. PC with IIS running successful, i tried IE and Mozilla,

the right name of sourcepath file is displayed... i tried it again with ur suggestion but no success...

i just downloaded the zip(newest version), just put the whole folder in my wwwroot folder, gave it access rights etc and started the demo.aspx via browser... before i modified the line in code, thats all...

other aspx pages im using working np... i feel kinda stupid, but theres nothing i can imagine what ive done wrong here :(

im using the exact same code in demo.asmx and the code behind file demo.asmx.cs both are in the standard folder "NeatUpload-1.0.8".

Reply | Threaded
Open this post in threaded view
|

Re: Hm saving file to HD doesnt work...

Dean Brettle
Administrator
Bizarre.  Maybe your changes aren't getting used at all.  Try changing:

bodyPre.InnerText = "Name: " + inputFile.FileName + "\n";

to:

bodyPre.InnerText = "Hello World!\n Name: " + inputFile.FileName + "\n";

rebuild, and see whether that shows up after an upload.

Also, compare the modification time of NeatUpload-1.0.8\bin\Brettle.Web.NeatUpload.dll to NeatUpload-1.0.8\Demo.aspx.cs.  The dll should have the later modification time.

 You could also try:

inputFileId.TmpFile.CopyTo(Path.Combine(Path.GetTempPath(), "test"));

to see whether copying the file to your temp directory works.

Please let me know how it goes.  Thanks,

--Dean
Reply | Threaded
Open this post in threaded view
|

Re: Hm saving file to HD doesnt work...

Guest-19

Hi,

thx again for help, unfortunately im kinda busy and i just tested it with "CopyTo" which didnt work and the browser displayed the Hello World! + Filename... i will do more tests the next days when im back home... but this is really bizarre...

But this procedure like i did should usually work ? i mean, i used the folder from the zip and copied it direct into my wwwroot ... and i just changed the demo.aspx coz the rest is ok i thought...

 

 

 

Reply | Threaded
Open this post in threaded view
|

Re: Hm saving file to HD doesnt work...

Dean Brettle
Administrator
But this procedure like i did should usually work ?

I thought so and no one has reported the problem you are experiencing before.  However, I'm not in a position to try to repro the problem personally because I don't have a Windows server to test with.  I do all my development/testing under Mono/Linux.

BTW, in case it wasn't clear, if you made the change to use:

inputFileId.TmpFile.CopyTo(Path.Combine(Path.GetTempPath(), "test"));

you will need to look for a file named "test" in your system temp directory (c:\windows\temp?).

Here's something else to try.  Remove (or comment out) the line in the Web.config which says

        <add key="NeatUpload.DefaultTempDirectory" value="NeatUploadTemp" />

If that line isn't there, NeatUpload should use your system temp dir.  So if there is some sort of permissions issue with writing to NeatUploadTemp, that should work around it.

You could also try temporarily commenting out:

            <add name="UploadHttpModule" type="Brettle.Web.NeatUpload.UploadHttpModule, Brettle.Web.NeatUpload" />

Knowing whether that makes a difference would help narrow the cause of the problem.

--Dean


Reply | Threaded
Open this post in threaded view
|

Re: Hm saving file to HD doesnt work...

Guest-19

Damn, i just tested it again at home and realized that even if i add

bodyPre.InnerText = "Hello World!\n Name: " + inputFile.FileName + "\n";

It always show me the standard lines:

Name: D:\Temp\test.bmp
Size: 14062556
Content type: image/bmp
 
SO no Hello World string before it ... its getting more bizarre now :(
Reply | Threaded
Open this post in threaded view
|

Re: Hm saving file to HD doesnt work...

Dean Brettle
Administrator
OK that's a big clue.  What is the modification time of bin\Brettle.Web.NeatUpload.dll and Demo.aspx.cs?  If the dll is more recent, try restarting your webserver to see if the change takes effect.

--Dean
Reply | Threaded
Open this post in threaded view
|

Re: Hm saving file to HD doesnt work...

Guest-19

modification time of bin\Brettle.Web.NeatUpload.dll is some days old...

from Demo.aspx.cs it is up to date, 1 min old...

Is it not tested for Windows and .Net Framework yet ?

 

Reply | Threaded
Open this post in threaded view
|

Re: Hm saving file to HD doesnt work...

Dean Brettle
Administrator
Many people are using NeatUpload under Windows/.NET.

Did you rebuild NeatUpload using VS.NET after making the change?  You need to do that because Demo.aspx.cs gets compiled into Brettle.Web.NeatUpload.dll.

--Dean
Reply | Threaded
Open this post in threaded view
|

Re: Hm saving file to HD doesnt work...

Guest-19

hm well, i just edited the demo.aspx file in the downloaded folder of the zip file and opened it after in a browser...

maybe thats the problem here :(

Reply | Threaded
Open this post in threaded view
|

Re: Hm saving file to HD doesnt work...

Dean Brettle
Administrator
Yep.  That's almost definitely the problem.  If you don't have the ability to recompile NeatUpload, you can still use it.  You just won't be able to modify the Demo directly.  Instead, try doing what I describe in this other thread:

http://www.brettle.com/ForumThreadView.aspx?thread=20&pageid=32&pageindex=7

I don't have a way to test that procedure under Windows/IIS, so no promises.  If it doesn't work, let me know and I'll see if I can produce a demo page that doesn' t use codebehind.

--Dean
Reply | Threaded
Open this post in threaded view
|

Re: Hm saving file to HD doesnt work...

Guest-19

Hi again,

i tried it out and it worked now ! :)

After that i tried to upload a 480 MB File over Network to the running ASP Server PC and it took like 85 Mins to transfer it but it worked...it was in the same folder like demo2.aspx and demo2.aspx.cs

Im not sure what i need to do now to implement neatupload in an already running ASP Application i got...

Can u please tell me what i exactly have to do, just for assurance ?

Do i need to add both dlls (Brettle.Web.NeatUpload.dll and log4net.dll) as reference to the Project ? Or just copy it to the \bin folder of my project ?

Do i need to edit my web.config ?

I have tried to do it with ur step by step manual but after that the same old errors occured... :(

Thx a lot for your help ! thats a great support !

  

Reply | Threaded
Open this post in threaded view
|

Re: Hm saving file to HD doesnt work...

Dean Brettle
Administrator
You need to copy both dlls to the bin folder.  I'm not sure whether you need to add them as references if you are dynamically compiling your pages like you appear to be.  You definitely need to add them as references if you are pre-compiling the codebehind like I do.

You do need to edit the web.config as described in the manual (ie increase httpRuntime maxRequestLength attribute and add the UploadHttpModule).

What errors are you seeing?  Is the progress bar getting displayed?  Does it say the upload completed but you can't find the file?

One thing that isn't mentioned in the manual is that you need to add methods like the following in order for Page_PreRender() to get called:

        protected override void OnInit(EventArgs e)
        {
            InitializeComponent();
            base.OnInit(e);
        }
        
        private void InitializeComponent()
        {
            this.Load += new System.EventHandler(this.Page_Load);
            this.PreRender += new System.EventHandler(this.Page_PreRender);
        }
     

BTW, are you using codebehind files or are you putting the code directly in the aspx file?

--Dean
Reply | Threaded
Open this post in threaded view
|

Re: Hm saving file to HD doesnt work...

Guest-19

Hi,

ok i will try this out soon.

I have noticed 1 other important thing, as i mentioned before, i tested it over Lan to upload a 500 MB file from 1 pc to another and i opened the demo2.aspx over my second PC (Client PC) and it took me like 80-90 mins to transfer it.

Well it worked, but i personally coming from the PHP Corner for Web Development and with a simple php input field page for uploads (no tools etc) and apache server instead of IIS, i can upload the same big file within 5 mins.

Umm, is that normal that Uploading Files with ASP is so slow ? Thats kinda strange and maybe a problem if i want to use the upload functionality over intranet and over web... :(  Does it take so mich time coz of the buffering process ?

Reply | Threaded
Open this post in threaded view
|

Re: Hm saving file to HD doesnt work...

Dean Brettle
Administrator
The performance difference could be an IIS/Apache difference or a PHP/ASP difference or a with/without NeatUpload difference.  To see if the difference is due to NeatUpload, compare how it takes to upload a smaller file with/without the UploadHttpModule commented out of the Web.config.  Use a smaller file because with the UploadHttpModule commented out, the entire file will be stored in server memory until it has finished uploading. 

Also FYI, you won't get a progress bar when the UploadHttpModule is commented out.  That is expected behavior.

Please let me know your results.

Thanks,

--Dean
Reply | Threaded
Open this post in threaded view
|

Re: Hm saving file to HD doesnt work...

Guest-19

I tested what u have mentioned and the download with PHP and ASP with a small file (like 5 mb) is similar, so not much difference.

i think asp would also do the "big" upload as fast as PHP if it wouldnt load the file completely in the IIS memory, which unfortunately causing to a memory leak...

but maybe im wrong... :)

1. u personally ever tested upload big files over web with neatupload ?

2. does neatupload always using the maximum internet upload speed ?

3. Is it possible to to set the "buffersize" which is used by neatupload to speed up the transfer ? or is it not possible/recommended ?

thx again for your awesome help/support in this case !

Reply | Threaded
Open this post in threaded view
|

Re: Hm saving file to HD doesnt work...

Dean Brettle
Administrator

I tested what u have mentioned and the download with PHP and ASP with a small file (like 5 mb) is similar, so not much difference.


Did you test with or without the UploadHttpModule?  What is the difference between with and without?

i think asp would also do the "big" upload as fast as PHP if it wouldnt load the file completely in the IIS memory, which unfortunately causing to a memory leak...

If you are running ASP with the UploadHttpModule, it shouldn't be loading the file into memory so that shouldn't be a bottleneck.  If you are seeing memory leak when you are using UploadHttpModule, that's a bug.

but maybe im wrong... :)

1. u personally ever tested upload big files over web with neatupload ?

I think I did test uploading large files to the XSP webserver running on the local machine, and didn't see a significant difference between with and without UploadHttpModule.  However, I have seen that Apache+mod_mono is much slower than using XSP (with or without UploadHttpModule), but there isn't much I can do about that.   I don't have access to an IIS server to test against.

2. does neatupload always using the maximum internet upload speed ?

It does not intentionaly throttle bandwidth if that's what you mean.  There could be a bug that causes it to underperform, or some other component could be throttling bandwidth.  I'm various interested in the former, and although I can't do much about the latter, I'd like to know about it so that I can let other NeatUpload user know about it.

3. Is it possible to to set the "buffersize" which is used by neatupload to speed up the transfer ? or is it not possible/recommended ?

It is currently hardcoded (via the variable named bufferSize in FilteringWorkerRequest.cs) but there shouldn't be any problem with increasing to value higher than it's current value of 4096.  Of course, I wouldn't recommend going above a few MB unless you have lots of memory on your server .  Feel free to experiment though, and let me know if you find a better value.  I haven't experimented with it at all.  Note: If you change bufferSize, you will need to rebuild Brettle.Web.NeatUpload.dll from source.

thx again for your awesome help/support in this case !

Glad to help.  Thanks for using NeatUpload!

--Dean

Reply | Threaded
Open this post in threaded view
|

Re: Hm saving file to HD doesnt work...

Guest-19

Hi again,

some new feedback:

a) after some tests i have found out that the bad transfer time for the big file was ONLY coz of Internet Explorer...

so i tried other browsers like Mozilla and it uploaded the 500 MB within 1,5 mins, which is very nice... so something must be wrong with the standard settings of IE or any other compatibility problem, maybe he is handling the httpmodule in a different way as Mozilla...

b) i tried to do some testing with the buffersize in the FilteringWorkerRequest.cs as u mentioned before and unfortunately there is some error after i compiled the project, he didnt show me any error but the <style ...> for the progress bar doesnt seem to compile correct. So i couldnt really test it...

If i copy the 2 dlls in a existing ASP Project it is working np =)

thx

Jason.

 

 

Reply | Threaded
Open this post in threaded view
|

Re: Hm saving file to HD doesnt work...

Guest-19

to b) again:

i think Visual Studio got a problem to compile the progress.aspx.cs class or something...

coz he is red underlining "<style...>" in the demo.aspx for example, so i think it has a problem to find the stylesheet, the current Schema doesnt support "style" is the error message when i try to compile the whole project.

Hope u know the answer, so i can compile the whole project to test some new values. :)

thx

 

12