Pankil Bhatt

Pankil Bhatt

  • 1.2k
  • 489
  • 77.4k

File Upload in asp.net c#

Jul 14 2016 3:18 AM
Hello
 
I want to file upload in asp.net c# using api url and key.
 anyone can help me.
 
Thanks

Answers (7)

0
Pankil Bhatt

Pankil Bhatt

  • 1.2k
  • 489
  • 77.4k
Jul 14 2016 3:34 AM
I know its php code but i need to convert this code in to c#
0
Bikesh Srivastava

Bikesh Srivastava

  • 81
  • 23.9k
  • 3.5m
Jul 14 2016 3:33 AM
Hi pankil ,
According your code i think you are PHP developer ,you need to move this query in PHP community .
0
Pankil Bhatt

Pankil Bhatt

  • 1.2k
  • 489
  • 77.4k
Jul 14 2016 3:30 AM
I need to upload a file to an external url<br />and check the files status<br />$key = "PUT YOUR API KEY HERE"; $settings['file_contents'] ="@/home/Downloads/emails.txt"; //path to your file $url = 'https://Testurl.com/api/verifApiFile?secret='.$key.'&amp;filename=my_emails.txt'; $ch = curl_init($url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $settings); $file_id = curl_exec($ch); //you need to save this FILE ID for get file status and download reports in future curl_close($ch);<br /><br />for upload file<br />AND<br /> $key = "PUT YOUR API KEY HERE"; $url = 'https://Testurl.com/api/getApiFileInfo?secret='.$key.'&amp;id=10700'; $string = file_get_contents($url); list($file_id,$filename,$unique,$lines,$lines_processed,$status,$timestamp,$link1,$link2) = explode('|',$string); //parse data<br />to check file status<br /><br />
0
Pankil Bhatt

Pankil Bhatt

  • 1.2k
  • 489
  • 77.4k
Jul 14 2016 3:27 AM
@ravi i tried not properly.
0
Pankil Bhatt

Pankil Bhatt

  • 1.2k
  • 489
  • 77.4k
Jul 14 2016 3:24 AM
I am try to upload the file to the server with particular path using api and key<br />api is tired party.
0
Ravi Patel

Ravi Patel

  • 271
  • 6.8k
  • 1.4m
Jul 14 2016 3:23 AM
Hi ,
refer this
 
http://www.c-sharpcorner.com/UploadFile/2b481f/uploading-a-file-in-Asp-Net-web-api/ 
http://www.asp.net/web-api/overview/advanced/sending-html-form-data-part-2
0
Bikesh Srivastava

Bikesh Srivastava

  • 81
  • 23.9k
  • 3.5m
Jul 14 2016 3:22 AM
Hi,
can you elaborate your query,and what you've tried .