Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

235
Vistas
How to create a custom link to a uploaded local file object?

I Want to generate a link for my local woff file. With help of createobjectURL function, A link is created, however, the penalty is in the way of a blob. The URL lifetime is tied to the document in the window on which it was created. The URL runs only on my browser, and when I close relevant tab, the file disappears. So, I'm trying to find a way using js function which creates a perm link to uploaded local file. Currently I used .

   

 <!DOCTYPE html>
    <html>
    <head>
      <meta charset="utf-8">
      <title>URL.createObjectURL example</title>
    </head>
    <body>
      <input type="file">
      <file>
      <p class="p">The URL of file is : </p>
    </body>
    <script>
        var Element = document.querySelector('input');
        var file = document.querySelector('file');
        Element.addEventListener('change', function() {
          var url = URL.createObjectURL(Element.files[0]);
          file.src = url;
          console.log(url);
          var d=document.querySelector(".p");
          d.textContent+=url;
    });
    </script>
    </html>
It creates blob:https://www.example.com/123 however I require https://www.example.com/123. I also tried Base 64 encoding. It works but the file size, and speed becomes a drawback even when it is compressed.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You're asking for one thing but giving an example of another here.

I Want to generate a permanent link for my local woff file.

You can't generate a URL to file://etc/etc since:

  • Browsers don't expose information about the user's file system to JS
  • If you could get a URL like that, then the browser wouldn't let the webpage link to it.

Access to local files is heavily restricted.


I require https://www.example.com/123

If you want the file to be available on your website: actually upload it to the website! Right now, the file only exists on the user's disk and in the memory being accessed by their browser.

You have to send the data to a server (e.g. with an Ajax POST request) where you have a webservice which reads the request, extracts the file from it, stores the file somewhere, gives it a URL, and then sends the URL back to the browser.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda