Vasu Gadhiya

Vasu Gadhiya

  • NA
  • 429
  • 103.3k

How To Upload File From Download link.

Jul 31 2014 7:38 AM
How To Upload File From Download link.

Consider following link.
 
 
this link download one pdf file.

how can i direct upload this pdf file in server using server.mappath() ?
 
 Thanks in advance.

Answers (7)

0
Guest User

Guest User

  • Tech Writer
  • 13.2k
  • 1m
Aug 10 2014 2:00 AM
You can use in your code like this:

return System.Net.Http.HttpRequestMessage.Request.Content.ReadAsMultiPartAsync(this)
0
Vasu Gadhiya

Vasu Gadhiya

  • 0
  • 429
  • 103.3k
Aug 9 2014 4:44 AM
As You say I add System.Net.Http;

But it occur same error. you can see in screenshot.

can you make small project for out this task.

0
Guest User

Guest User

  • Tech Writer
  • 13.2k
  • 1m
Aug 8 2014 3:12 AM
this class is part of WebApi in .net

Refer Telerik blog 
http://www.telerik.com/support/kb/data-access/details/manually-installing-references-required-by-the-web-api-service
0
Vasu Gadhiya

Vasu Gadhiya

  • 0
  • 429
  • 103.3k
Aug 7 2014 2:08 AM
i cant find System.Net.Http;

i am using .net 4.0 (VS 2010).
0
Guest User

Guest User

  • Tech Writer
  • 13.2k
  • 1m
Aug 6 2014 7:03 AM
I missed to tell you, use this:
using System.Net.Http;

//so it'll be like System.Net.Http.HttpRequestMessage.Request
0
Vasu Gadhiya

Vasu Gadhiya

  • 0
  • 429
  • 103.3k
Aug 6 2014 3:42 AM
Error in Request.Content


Error2'System.Web.HttpRequest' does not contain a definition for 'Content' and no extension method 'Content' accepting a first argument of type 'System.Web.HttpRequest' could be found (are you missing a using directive or an assembly reference?)



0
Guest User

Guest User

  • Tech Writer
  • 13.2k
  • 1m
Aug 1 2014 10:07 PM
Following convention, we generally upload at App_Data folder but you can choose any folder of your own choice

to upload you can now enjoy power of async so your application doesn't wait for that process to complete, use below snippet as reference

protected Task DoUpload()
        {
            try
            {
                return Request.Content.ReadAsMultipartAsync(this)
                    
            }
            catch (System.Exception e)
            {
                throw e;
            }
        }