Downloading file with Javascript is giving “Failed - No file” error

Asked
Active3 hr before
Viewed126 times

10 Answers

downloadingerrorjavascript
90%

I am trying to download a file test.txt when a button is clicked in a React Javascript project. My App.js and test.txt files are in the same directory., Can I set fire to the rain? , Does Nondetection protect you from divination attack spells?

Pretag
 Pretag team - issue, fix, solve, resolve
88%

Download a file from the FTP server, and save it into a local file: , Because I want javascript to download the file from server not anything else. The issue is actually that after the downloading is done I want to get a status that downloading is done which is not fulfilling from above methods as window.open() doesn't have any return type. So if u can put some light on it would be very helpful for me.,Attacking the darkness download torrent

Pretag
 Pretag team - issue, fix, solve, resolve
72%

Sometimes you will see the download error “Insufficient Permissions or system busy” when you try to download the file using Chrome. To fix this error you can easily do some steps given below:,When it comes to downloading a file from the Internet, you might have faced some of the errors in Chrome. Whether it’s a small or a big file, there might be an error which can conflict the download operation in Google Chrome. There could be many errors like downloads blocked, network failed, no file or the file is missing, forbidden, insufficient permissions etc. These problems can arise from some third-party application or malicious software installed, there could be many reasons. If you are facing such errors then you need to know that they are easily fixable.,If your antivirus blocked the file download then check the error log for the reason. We strongly recommend not try to download the malicious files that your antivirus blocks.

Pretag
 Pretag team - issue, fix, solve, resolve
65%

I've tried generating 206 response in service-worker, but not luck - Chrome gives me Failed - No file error., Use partial response instead of ReadableStream in service worker or use both?,Also worth mentioning that even if Chrome receives following headers: (for some reason headers from service worker are received on lowercase)

headers = {
   'Content-Type': 'application/octet-stream; charset=utf-8',
   'Content-Disposition': "attachment; filename*=UTF-8''" + filename,
   'Content-Range': 'bytes 0-20/20',
   'Content-Length': '20'
}
var resp = new Response("12345678901234567890", {
   status: 206,
   headers: headers
})
event.respondWith(resp)
load more v
75%

@RnRMusicMan That worked, but I don't have HP Scan on my computer, or if I do, I don't see it. I've been using webscan and that's what is giving me trouble.,Thanks, @RnRMusicMan, but Troubleshooter found nothing., Webscan "failed no file" error when trying to save a pdf

Pretag
 Pretag team - issue, fix, solve, resolve
40%

File is downloading with Failed - No file error,Need to download dynamic files which is returned from the api in the client side based on its type. This is what i have,With above implementation file is downloading but when i try to open the file, below is showng

My api controller it looks like this

    public async Task<IActionResult> GetFile(int id)
    {

         IBaseResult<UserDetails> result = await _Bo.GetUSerDetails(id);
         
         //result will have content likes 

         //1. FileName//fileaname.{extention}
         //2. FileType//eg.application/pdf or application/doc
         //3. FileContent//byte[]

         if (result.Data != null)
         {
             response.Success = result.success;
             response.Data = result.Data;

             return Ok(response);
         }
     }

.ts file looks like this

  data.service.ts

  getResume(methodName: string, id :string): Observable<any> {
       let httpOptions = this.getAuthoriseHeader();
       return this.http.get(environment.baseApiUrl + methodName + id, { headers: httpOptions, observe: 'response', responseType: 'blob' });

   }

  view.component.ts

     this.dataservice.getResume(method, id).subscribe(result => {
         var resume = result["data"];
         var fileName = resume.resumeName;
         var fileType = resume.resumeType;

         const file = new Blob([resume.resume], { type: fileType  });//Is this correct or do i need to use 'application/octet-stream' here?

         saveAs(file, fileName);
     });

var fileName = resume.resumeName; var fileType = resume.resumeType; //var byteArray = new Uint8Array(resume.resume);

      const file = new Blob([resume.resume], {
         type: 'application/octet-stream'
      });

      this.fileUrl = this.sanitizer.bypassSecurityTrustResourceUrl(window.URL.createObjectURL(file));

      let a = document.createElement('a');
      document.body.appendChild(a);
      a.setAttribute('style', 'display: none');
      a.href = this.fileUrl;
      a.download = fileName;
      a.click();
      window.URL.revokeObjectURL(this.fileUrl);
      a.remove();
load more v
22%

The export functionality is not working and is giving the error: ,I am using the version: 13.2.20132.1010 (as mentioned in infragistics.core.js file),-infragistics.documents-core.js

Pretag
 Pretag team - issue, fix, solve, resolve
60%

Pretag
 Pretag team - issue, fix, solve, resolve
48%

If you are not an extension developer and want to install this extension please proceed to Chrome Web Store,(2019-08-22, v:5.0.7) Lea Gary: The ChroPath in the chrome developer's tool has an incorrect displayIn my chrome browser, the chropath tools are all squashed together,(2021-04-04) Brave Johen: Chropath is outdated & breaking a lot. SelectorsHub is the new next Gen Xpath tool which very advanced and powerful than chropath. SelectorsHub is the new xpath tool, created by ChroPath creator only. https://selectorshub.com/

Pretag
 Pretag team - issue, fix, solve, resolve
23%

Pretag
 Pretag team - issue, fix, solve, resolve

Other "downloading-error" queries related to "Downloading file with Javascript is giving “Failed - No file” error"